- 博客(7)
- 收藏
- 关注
原创 LeetCode 406.根据身高重建队列
这道题目,有两个考点:二维数组的针对某一位的排序 排序之后插入的方法class Solution { public int[][] reconstructQueue(int[][] people) { Arrays.sort(people, 0, people.length, new MyComparator()); List&l...
2019-12-09 19:28:57 230
原创 Leetcode 739.每日温度
// this is a problem of stackclass Solution { public int[] dailyTemperatures(int[] T) { int len = T.length; int[] res = new int[len]; Stack<Integer> st = new Stack&...
2019-12-06 15:22:16 80
原创 Leecode 7.整数反转
class Solution { public int reverse(int x) { // here we should know that -123 % 10 = -3 here in Java and C++ int ans = 0; while (x != 0) { in...
2019-12-05 17:59:32 70
原创 Leetcode 64. 最小路径和
class Solution { public int minPathSum(int[][] grid) { if (grid.length == 0) return 0; if (grid[0].length == 0) return 0; int row = grid.length; int col = grid[0]....
2019-09-30 17:06:24 64
原创 Leetcode 30. 串联所有单词的子串 (O(n * m))
class Solution { public List<Integer> findSubstring(String s, String[] words) { List<Integer> res = new ArrayList<Integer>(); int num = words.length; if ...
2019-09-26 10:30:15 100
原创 LeetCode 239. Sliding Window Maximum
class Solution { public int[] maxSlidingWindow(int[] nums, int k) { if (nums.length == 0) return new int[0]; int res_length = nums.length - k + 1; int[] res = ...
2019-08-22 20:46:44 69
原创 LeetCode 2. 两数相加
/*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode(int x) { val = x; }* }*/class Solution { public ListNode addTwoNumb...
2019-08-21 20:09:08 83
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人