aud
aud
全部文章
LeetCode
JAVA面试OFFER直通车(37)
linux(2)
mysql(3)
实习笔记(19)
错误记录(9)
面试中不会的(8)
面试基础知识准备(13)
面试复盘(2)
项目笔记(45)
归档
标签
去牛客网
登录
/
注册
aud的博客
全部文章
/ LeetCode
(共35篇)
[LeetCode]Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the...
2020-05-27
0
448
两个理解KMP的博文
http://kb.cnblogs.com/page/176818/ http://blog.csdn.net/hyjoker/article/details/51190726
2020-05-27
0
462
[LeetCode]Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 平衡二叉树: 1、若任意节点的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 2、若任意...
2020-05-27
0
469
刷题中遇到的java的坑
1.字符的输入问题(牛客网用的比较多) nextLine() 会自动读取 字符串末尾的\n,因此以后刷题 遇到输入数字的 直接用 scan.nextInt() ,nextDouble() , nextFloat() 输入字符串的 用 scan.next() 或者 scan.nextL...
2020-05-27
0
953
排序算法整理
时间复杂度为O(n^2)的: 插入、选择(不稳定)、冒泡 时间复杂度为O(nlogn)的: 堆(不稳定),快速(不稳定),归并 一、插入排序 将数组中的所有元素依次跟前面已经排好的元素相比较,如果选择的元素比已排序的元素小,则交换,直到全部元素都比较过为止。 ...
2020-05-27
0
594
前缀和汇总
leet560 求和等于 K 的子数组数量 (1)暴力解法 (2)前缀和 sum(i~j) = s(j) - s(i-1) = k s(j) - k = s(i-1) 保存三个状态: sum,sum-k,cnt def subarrayS...
leetcode
前缀和
2020-05-27
0
568
Lc 反转链表【递归】
206. 反转链表: def reverseList(head): pre = None p = head while p: nextNode = p.next p.next = pre...
2020-05-27
0
421
课程安排汇总
lc 210 把课程关系转成有向图,对图进行深度优先遍历,checked标记已经访问过的节点,order保存访问顺序 也用到了回溯算法: class Solution: # checked 数组保存已经保存过的节点, visited记录当前访问过的节点, checked记录访问...
2020-05-27
0
406
Lc200 小岛数量
每次碰到‘1’就用DFS遍历联通的1,把遍历的1标记为已访问; dfs单独写成一个函数 class Solution: def _init_2d(self,row,col): d= [] for i in range(row): ...
2020-05-27
0
504
回文字符串判断汇总
Lc 125 验证回文字符串 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 class Solution: def judgeNumOrStr(self,a): if ord('0')<=ord(a)<=ord('9') ...
2020-05-27
0
519
首页
上一页
1
2
3
4
下一页
末页