Leetcode
刷题记录
weshell_
花有重开日,人无再少年。
展开
-
20. 有效的括号
给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。有效字符串需满足:左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。注意空字符串可被认为是有效字符串。bool isValid(char * s) { int len = strlen(s); // 校验 if ((s == NULL) || (len % 2 == 1)) { return false; } char原创 2020-06-18 13:16:59 · 96608 阅读 · 0 评论 -
两数之和
/** Note: The returned array must be malloced, assume caller calls free().*/int* twoSum(int* nums, int numsSize, int target) { static int a[2] = {0}; for (int i = 0; i < numsSize ...原创 2019-04-14 09:23:25 · 96544 阅读 · 0 评论