- 博客(20)
- 收藏
- 关注
原创 83 Remove Duplicates from Sorted List
题目链接:https://leetcode.com/problems/remove-duplicates-from-sorted-list/题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->
2015-10-30 20:06:34 291
原创 80 Remove Duplicates from Sorted Array II
题目链接:https://leetcode.com/problems/remove-duplicates-from-sorted-list/题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,
2015-10-30 19:45:32 236
原创 79 Word Search
题目链接:https://leetcode.com/problems/word-search/题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacen
2015-10-28 21:23:50 361
原创 76 Minimum Window Substring
题目链接:https://leetcode.com/problems/minimum-window-substring/题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S
2015-10-26 20:57:16 399
原创 77 Combinations
题目链接:https://leetcode.com/problems/combinations/题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [
2015-10-25 16:20:02 1458
原创 74 Search a 2D Matrix
题目链接:https://leetcode.com/problems/search-a-2d-matrix/题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sor
2015-10-22 20:36:35 1166
原创 Scala小笔记
定义变量。用val或var来定义,后面跟变量名,然后可以加上类型(也可以不加,多数情况下scala能自己推断出来)。如val obj = getO2AObject();而不是Object obj = getO2AObject();for循环。在scala中for循环是个比较复杂的东西,”Scala By Example”里专门有一章讲for循环,这里我就不展开讲了,只讲一个最简单的用法,就是for
2015-10-22 16:15:10 312
原创 73 Set Matrix Zeroes
题目链接:https://leetcode.com/problems/set-matrix-zeroes/题目:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra
2015-10-21 20:50:44 653
原创 70 Climbing Stairs
题目链接:https://leetcode.com/problems/climbing-stairs/题目: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
2015-10-20 20:42:07 411
原创 68 Text Justification
题目链接:https://leetcode.com/problems/text-justification/题目:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You
2015-10-20 20:11:36 405
原创 67 Add Binary
题目链接:https://leetcode.com/problems/add-binary/题目:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".解题思路: 这题的思路已经用过很多次了。比如,大整数加法,十进制字符串相加等。把两
2015-10-17 16:12:08 1185
原创 63 Unique Paths II
题目链接:https://leetcode.com/problems/unique-paths-ii/题目:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty spac
2015-10-17 15:31:45 1188
原创 62 Unique Paths
题目链接:https://leetcode.com/problems/unique-paths/题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any po
2015-10-14 21:49:20 1161
原创 61 Rotate List
题目链接:https://leetcode.com/problems/rotate-list/题目:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3-
2015-10-14 20:58:50 889
原创 60 Permutation Sequence
题目链接:https://leetcode.com/problems/permutation-sequence/题目:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following
2015-10-14 19:26:47 1113
原创 58 Length of Last Word
题目链接:https://leetcode.com/problems/length-of-last-word/题目: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 las
2015-10-11 17:45:07 479
原创 57 Insert Interval
题目链接:https://leetcode.com/problems/insert-interval/题目:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were init
2015-10-11 17:23:42 865
原创 56 Merge Intervals
题目链接:https://leetcode.com/problems/merge-intervals/题目:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].解题思路:先
2015-10-11 15:26:34 377
原创 55 Jump Game
题目链接:https://leetcode.com/problems/jump-game/题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum j
2015-10-07 20:00:54 298
原创 50 Pow(x, n)
题目链接:https://leetcode.com/problems/powx-n/题目:Implement pow(x, n).解题思路: 采用的是将指数不断地除以 2 ,划分为更小的指数,递归求解。如果当前指数是偶数,则 当前的幂值 = 指数为当前指数 1 / 2 的幂值的平方如果当前指数是奇数,则 当前的幂值 = 指数为当前指数 1 / 2 的幂值的平方 * 底数例如: pow(
2015-10-04 19:02:42 495
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人