摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Y 阅读全文
posted @ 2019-01-28 13:22 Schwifty 阅读(165) 评论(0) 推荐(0)
摘要: Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the thr 阅读全文
posted @ 2019-01-28 11:16 Schwifty 阅读(124) 评论(0) 推荐(0)
摘要: class Solution { public List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); List<List<Integer>> res = new ArrayList(); for(int i = 0; i < nu 阅读全文
posted @ 2019-01-28 10:02 Schwifty 阅读(172) 评论(0) 推荐(0)
摘要: leetcode 21道 前端从放弃到入门 p1-p20 阅读全文
posted @ 2019-01-28 06:13 Schwifty 阅读(138) 评论(0) 推荐(0)
摘要: Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文
posted @ 2019-01-28 02:51 Schwifty 阅读(137) 评论(0) 推荐(0)
摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ 阅读全文
posted @ 2019-01-19 10:26 Schwifty 阅读(181) 评论(0) 推荐(0)
摘要: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2019-01-01 08:04 Schwifty 阅读(149) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2018-12-31 00:26 Schwifty 阅读(171) 评论(0) 推荐(0)
摘要: Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1 阅读全文
posted @ 2018-12-24 04:07 Schwifty 阅读(129) 评论(0) 推荐(0)
摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文
posted @ 2018-12-23 04:03 Schwifty 阅读(153) 评论(0) 推荐(0)