摘要:
void recursion(char * digits, int* returnSize,char** arr,char** map,int cur,char* s,int len){ if (cur >= len){ arr[(*returnSize)] = (char*)calloc(len 阅读全文
摘要:
#define INT_MAX 2147483647 int cmp(const void* a, const void* b){ return *(int*)a - *(int*)b; // 快排构造递增序列 } int threeSumClosest(int* nums, int numsSiz 阅读全文
摘要:
int CompareByIncrease(const void* a, const void* b){ return *(int*)a - *(int*)b; // 快排构造递增序列 } int** threeSum(int* nums, int numsSize, int* returnSize 阅读全文
摘要:
/*JAVA*/ int[] values = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; String[] symbols = {"M","CM","D","CD","C","XC","L","XL","X","IX","V"," 阅读全文
摘要:
/*C++双指针*/ class Solution { public: int maxArea(vector<int>& height) { int l = 0, r = height.size() - 1; int ans = 0; while (l < r) { int area = min(h 阅读全文
摘要:
/* 方法2 */ int myAtoi(char *str) { long n = 0; int sign = 0; /* 跳过空格 */ while (*str == ' ') ++str; /* 判断符号 */ if(*str == '-' || *str == '+') { sign = ( 阅读全文
摘要:
char * convert(char * s, int numRows){ if (numRows < 2) return s; int i, j, pst = 0, len = strlen(s), cnt; char* retStr = (char*)calloc(len + 1, sizeo 阅读全文
摘要:
/*Manacher 算法*/ #include <iostream> #include <string> #include <vector> using namespace std; class Solution { public: string longestPalindrome(string 阅读全文
摘要:
int minimumOperations(char* leaves) { int n = strlen(leaves); int f[n][3]; f[0][0] = (leaves[0] == 'y'); f[0][1] = f[0][2] = f[1][2] = INT_MAX; for (i 阅读全文
摘要:
int lengthOfLongestSubstring(char * s){ int i, j = 0, count = 0, max = 0, index[128] = { 0 }, start = 0; for (i = 0; s[i] != '\0'; i++) { if (index[s[ 阅读全文