- 博客(10)
- 收藏
- 关注
原创 SQL系列
175. Combine Two Tables 176. Second Highest Salary 177. Nth Highest Salary 178. Rank Scores 180. Consecutive Numbers 181. Employees Earning More Than Their Managers 182. Duplicate Emails 183. Customer...
2019-05-28 16:52:56 368
原创 LeetCode--312. Burst Balloons && 223. Rectangle Area
223. Rectangle Area class Solution { public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int area1=(C-A)*(D-B); int area2=(G-E)*(H-F)...
2019-05-21 22:39:13 178
原创 LeetCode WeekContest 137
1046. Last Stone Weight class Solution { public int lastStoneWeight(int[] stones) { PriorityQueue<Integer> pq=new PriorityQueue<>((x,y)->{return y-x;}); for(int num:...
2019-05-21 14:20:36 167
原创 LeetCode--栈专题
385. Mini Parser /** * // This is the interface that allows for creating nested lists. * // You should not implement it, or speculate about its implementation * public interface NestedInteger { * ...
2019-05-17 21:13:02 265
原创 LeetCode--257. Binary Tree Paths && 283. Move Zeroes
257. Binary Tree Paths 常用递归操作 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * }...
2019-05-12 16:07:43 133
原创 字节跳动2019春招研发部分编程题
1.自动校对程序 import java.util.LinkedList; import java.util.Scanner; public class ByteDance1 { public static String solve(String s) { LinkedList<int[]> list = new LinkedList<>(...
2019-05-10 17:20:34 1514
原创 LeetCode刷题总结--DFS与字符串处理
388. Longest Absolute File Path "dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext"则个字符串序列是由文件目录树的深度优先搜索(先根遍历)得到的,所以需要借助栈来进行解析这个字符串得到所有全路径,从而比较全路径字符串的长度。这里要注意的是...
2019-05-09 17:33:48 504
原创 回文串问题与动态规划
回文串的算法问题几乎都是用动态规划解决的。 5. Longest Palindromic Substring 算法一:从对称中心扩展,算法时间复杂度O(N2)O(N^2)O(N2),空间复杂度为O(1)O(1)O(1); class Solution { public String longestPalindrome(String s) { int n = s.length...
2019-05-07 16:57:58 619
原创 LeetCode-290. Word Pattern & 415. Add Strings & 306. Additive Number
290. Word Pattern class Solution { public boolean wordPattern(String pattern, String str) { String[] strs=str.split(" "); if(pattern.length()!=strs.length) return false...
2019-05-04 23:59:08 129
原创 LeetCode-304. Range Sum Query 2D - Immutable & 307. Range Sum Query - Mutable
303. Range Sum Query - Immutable class NumArray { int[] accum; public NumArray(int[] nums) { accum=new int[nums.length+1]; for(int i=1;i<=nums.length;i++)...
2019-05-04 23:52:45 112
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人