摘要:
买卖股票的最佳时期(121) class Solution { public int maxProfit(int[] prices) { int res = 0; int min = Integer.MAX_VALUE; for (int i = 0; i < prices.length; i++) 阅读全文
摘要:
虽然更多用的是桶 数组中的第k个最大元素(215) 桶排序 class Solution { public int findKthLargest(int[] nums, int k) { int[] buckets = new int[200001]; for (int i = 0; i < num 阅读全文
摘要:
搜索插入位置(035) class Solution { public int searchInsert(int[] nums, int target) { int n = nums.length; int lef = -1; int rig = n; while(lef+1 < rig){ int 阅读全文
摘要:
单词搜索(079) class Solution { int m, n; public boolean exist(char[][] board, String word) { m = board.length; n = board[0].length; char[] words = word.to 阅读全文