算法&数据结构
圣骐
这个作者很懒,什么都没留下…
展开
-
括号匹配
LeetCode 20括号匹配 #include <iostream> #include <string> #include <stack> using namespace std; class Solution { public: bool isValid(string s) { if (s.empty()) ...原创 2019-05-04 10:35:00 · 97 阅读 · 0 评论 -
一段代码对指针的理解
#include <stdio.h> int main() { int a[5] = {1,2,3,4,5}; int *ptr = (int *)(&a+1); //int **p =&a; printf("%d %d\n",*(a+1),*(ptr-1)); return 0; } 上面代码输出结果是2,5。ptr是双重指...原创 2019-04-18 15:18:14 · 151 阅读 · 0 评论 -
myAtoi
LeetCode字符串转整数 int myAtoi(char * str){ #define MAX_INT 0x7FFFFFFF #define MIN_INT 0x80000000 long long tmp_res = 0; //int res; int is_negtive = 0; char *p =str; char *q; ...原创 2019-04-30 14:35:47 · 195 阅读 · 1 评论