LeetCode刷题
随机刷题
sdlkjaljafdg
不曾拥有,何来失去
展开
-
python3 pandas
pandas - Python Data Analysis Library原创 2024-05-24 23:45:00 · 266 阅读 · 0 评论 -
cpp rand
在测试时将被调用的次数。请注意,这不是传递给。且不能调用其他方法。范围内的均匀随机整数,试写一个方法。给定圆的半径和圆心的位置,实现函数。每个测试用例将有一个内部参数。,在圆中产生均匀随机点。范围内的均匀随机整数。原创 2024-05-20 10:00:57 · 276 阅读 · 0 评论 -
编译报错问题汇总
【代码】编译报错问题汇总。原创 2023-12-04 16:25:04 · 838 阅读 · 0 评论 -
C 语言 实现 Queue
【代码】C 语言 实现 Queue。原创 2023-11-24 18:16:49 · 136 阅读 · 0 评论 -
C 语言 实现 List
【代码】C 语言 实现 List。原创 2023-11-24 17:37:57 · 611 阅读 · 0 评论 -
c 十进制转化为二进制 位操作
【代码】c 十进制转化为二进制 位操作。原创 2023-11-24 13:53:41 · 48 阅读 · 0 评论 -
c语言实现 s_gets
【代码】c语言实现 s_gets。原创 2023-11-23 17:35:04 · 54 阅读 · 0 评论 -
2. Add Two Numbers
【代码】2. Add Two Numbers。原创 2023-07-24 22:19:51 · 71 阅读 · 0 评论 -
华为2023: 2.树上逃离
【代码】华为2023: 2.树上逃离。原创 2023-04-20 02:04:23 · 245 阅读 · 1 评论 -
c++ 基础
【代码】c++ 基础。原创 2023-02-16 20:01:27 · 82 阅读 · 0 评论 -
leetcode297. Serialize and Deserialize Binary Tree
Serialize and Deserialize Binary Tree原创 2022-12-04 16:41:55 · 131 阅读 · 0 评论 -
C++ 数据结构图(Graph)的邻接表构造
C++ 数据结构图(Graph)的邻接表构造原创 2022-07-06 14:18:55 · 676 阅读 · 0 评论 -
CMakeLists.txt编写
cmake_minimum_required(VERSION 3.23)project(RPC)include_directories( ./include)link_directories( ./lib)set(CMAKE_CXX_STANDARD_REQUIRED ON)set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -pthread -fopenmp").原创 2022-04-22 19:47:20 · 410 阅读 · 0 评论 -
CMake 交叉编译demo
# the name of the target operating systemset(CMAKE_SYSTEM_NAME Linux)# which C and C++ compiler to useset (CMAKE_C_COMPILER /home/alex/eldk-mips/usr/bin/mips_4KC-gcc)set (CMAKE_CXX_COMPILER /home/alex/eldk-mips/usr/bin/mips_4KC-g++)# location .原创 2022-04-02 23:58:06 · 532 阅读 · 0 评论 -
日常 liunx使用笔记
1vim全局路径替换命令:%s#/home/szs/stb/stsdk/A36/rpmbuild/BUILD#/home/yinjiabin/qt#g解释:将/home/szs/stb/stsdk/A36/rpmbuild/BUILD替换为/home/yhinjiabin/qt2. autotool编译工具,常用参数./configure CC=gcc CXX=g++ --host=x86_64-pc-linux-gnu --enable-shared=no --enable-static.原创 2022-03-30 00:17:59 · 1780 阅读 · 0 评论 -
C语言输出int型整数的二进制值(使用结构体位域)
#define _CRT_SECURE_NO_WARNINGS#include<stdlib.h>#include<stdio.h>struct bits//结构体{ unsigned char bit1 : 1;//位域 unsigned char bit2 : 1; unsigned char bit3 : 1; unsigned char bit4 ...原创 2018-03-22 22:41:23 · 1740 阅读 · 1 评论 -
定义指针变量高32位清零的宏COMPAT_POINTER
/* 定义指针变量高32位清零的宏COMPAT_POINTER */#define HI_COMPAT_POINTER(ptr, type) \do { \hi_ulong ulAddr = (hi_ulong)ptr; \hi_u32 u32Addr = (hi_u32)ulAddr; \ptr = (type)(hi_ulong)u32Addr; \} while (0)原创 2022-03-28 09:22:23 · 438 阅读 · 0 评论 -
获取指定文件md5
#include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <dirent.h>#include <string.h>#include <signal.h>#define FilePath "./include/"/*******************************************************************.原创 2022-01-21 15:54:38 · 1767 阅读 · 0 评论 -
# 68. 文本左右对齐
class Solution: def fullJustify(self, words: List[str], maxWidth: int) -> List[str]: res = [] line = [] length = 0 for word in words: if len(word) + length > maxWidth: spaces = maxWidth.原创 2021-11-23 07:39:02 · 311 阅读 · 0 评论 -
# 65. 有效数字
from enum import Enumclass Solution: def isNumber(self, s: str) -> bool: State = Enum("State", [ "STATE_INITIAL", "STATE_INT_SIGN", "STATE_INTEGER", "STATE_POINT", "STATE_POINT_W.原创 2021-11-23 07:10:30 · 317 阅读 · 0 评论 -
# 64. 最小路径和
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: m = len(grid) n = len(grid[0]) fn = [[0] * n for _ in range(m)] fn[0][0] = grid[0][0] for i in range(1, m, 1): fn[i][0.原创 2021-11-23 07:07:36 · 198 阅读 · 0 评论 -
# 63. 不同路径 II
class Solution: def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int: m = len(obstacleGrid) n = len(obstacleGrid[0]) fn = [[0] * n for _ in range(m)] for i in range(m): if obstacle.原创 2021-11-23 06:30:33 · 194 阅读 · 0 评论 -
# 62. 不同路径
class Solution: def uniquePaths(self, m: int, n: int) -> int: fn = [[0] * n for _ in range(m)] for i in range(m): for j in range(n): if i == 0 or j == 0: fn[i][j] = 1 e.原创 2021-11-22 23:44:45 · 57 阅读 · 0 评论 -
# 60. 排列序列
暴力解法:class Solution: def getPermutation(self, n: int, k: int) -> str: nums = [str(i+1) for i in range(n)] if(len(nums) == 0): return "" tmp = [] res = [] flag = [0] * len(nums) def back.原创 2021-11-22 23:17:14 · 106 阅读 · 0 评论 -
#51. N 皇后
class Solution: def solveNQueens(self, n: int) -> List[List[str]]: res = [] board = [['.'] * n for _ in range(n)] def backtrace(rowIndex: int) -> None: if(rowIndex == len(board)): res.append(se.原创 2021-11-22 22:56:34 · 65 阅读 · 0 评论 -
#47. 全排列 II
class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: if(len(nums) == 0): return [] nums.sort() tmp = [] res = [] flag = [0] * len(nums) def backtrace(): .原创 2021-11-22 22:14:12 · 208 阅读 · 0 评论 -
#46. 全排列
class Solution: def permute(self, nums: List[int]) -> List[List[int]]: if(len(nums) == 0): return [] tmp = [] res = [] flag = [0] * len(nums) def backtrace(): if (len(tmp) == len(nums).原创 2021-11-22 22:03:15 · 72 阅读 · 0 评论 -
# 55. 跳跃游戏
class Solution: def canJump(self, nums: List[int]) -> bool: n, rightmost = len(nums), 0 for i in range(n): if i <= rightmost: rightmost = max(rightmost, i + nums[i]) if rightmost >= .原创 2021-11-22 21:41:02 · 2698 阅读 · 0 评论 -
#45. 跳跃游戏 II
class Solution: def jump(self, nums: List[int]) -> int: fn = [len(nums) + 1] * len(nums) fn[0] = 0 for i in range(len(nums)): for j in range(1, nums[i]+1, 1): if (i + j >= len(nums)): .原创 2021-11-22 21:21:25 · 2405 阅读 · 0 评论 -
#44. 通配符匹配
class Solution: def isMatch(self, s: str, p: str) -> bool: m, n = len(s), len(p) dp = [[False] * (n + 1) for _ in range(m + 1)] dp[0][0] = True for i in range(1, n + 1): if p[i - 1] == '*': .原创 2021-11-22 02:36:27 · 202 阅读 · 0 评论 -
# 42. 接雨水
暴力解法class Solution: def trap(self, height: List[int]) -> int: res = 0 for i in range(len(height)): max_left, max_right = 0, 0 for j in range(i, -1, -1): max_left = max(max_left, height[j])原创 2021-11-22 02:30:18 · 236 阅读 · 0 评论 -
#40. 组合总和 II
class Solution: def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]: candidates.sort() res = [] tmp = [] def backtrace(starIndex: int) -> None: if(sum(tmp) == target): .原创 2021-11-21 18:57:25 · 293 阅读 · 0 评论 -
#39. 组合总和
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: res = [] tmp = [] def backtrace(starIndex: int) -> None: if(sum(tmp) == target): res.append(tmp..原创 2021-11-21 18:35:30 · 197 阅读 · 0 评论 -
#37. 解数独
class Solution: def solveSudoku(self, board: List[List[str]]) -> None: """ Do not return anything, modify board in-place instead. """ def backtrace()-> bool: for i in range(9): for j in.原创 2021-11-21 17:18:54 · 193 阅读 · 0 评论 -
# 53. 最大子序和
class Solution: def maxSubArray(self, nums: List[int]) -> int: fn = nums.copy() tmp = [] for i in range(1, len(nums), 1): if(nums[i] <= 0): if fn[i-1] >= 0: fn[i] = fn[i-.原创 2021-11-14 21:41:32 · 708 阅读 · 0 评论 -
# 30. 串联所有单词的子串
class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: word = len(words[0]) firstworld = set([word[0] for word in words]) allwords = len(words) * word res = [] flag = dict({}) .原创 2021-11-08 01:47:26 · 133 阅读 · 0 评论 -
source insight4 配置设置
source insight 4 配置设置转载 2021-11-05 17:06:39 · 137 阅读 · 0 评论 -
C打印int数据的二进制位
#include <stdlib.h>#include <stdio.h>#include <string.h>typedef struct{ unsigned int a:4; unsigned int b:4; int c:4;}test;void print_bin(int n){ int l = sizeof(n)*8;//总位数。 int i; if(l == 0) { printf("0.原创 2021-11-05 14:07:42 · 299 阅读 · 0 评论 -
#17. 电话号码的字母组合
/** * Note: The returned array must be malloced, assume caller calls free(). */char *hashMap[10] = {"_", "!@#", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; void backtrace(char **result, int *returnSize, char *tmp, int *tmpSize, char *di.原创 2021-11-04 01:12:52 · 96 阅读 · 0 评论 -
#32. 最长有效括号
int longestValidParentheses(char * s){ int *f = (int *)malloc(sizeof(int) * strlen(s)); memset(f, 0, sizeof(int) * strlen(s)); int i; int res = 0; for(i = 1; i<strlen(s); i++) { if(s[i] == ')') { if(i.原创 2021-11-03 02:31:36 · 127 阅读 · 0 评论