随笔分类 -  leetcode

摘要:``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Source : https://oj.leetcode.com/problems/word-search/ * * * Given a 2D board and a word, find if the word ex... 阅读全文
posted @ 2017-10-27 08:31 lacker 阅读(135) 评论(0) 推荐(0)
摘要:``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Source : https://oj.leetcode.com/problems/subsets/ * * * Given a set of distinct integers, S, return all poss... 阅读全文
posted @ 2017-10-27 00:14 lacker 阅读(121) 评论(0) 推荐(0)
摘要:```java import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Source : https://oj.leetcode.com/problems/combinations/ * * * Given two integers n and k, return all poss... 阅读全文
posted @ 2017-10-26 08:25 lacker 阅读(133) 评论(0) 推荐(0)
摘要:``` import java.util.HashMap; import java.util.Map; /** * * Source : https://oj.leetcode.com/problems/minimum-window-substring/ * * * Given a string S and a string T, find the minimum window in ... 阅读全文
posted @ 2017-10-26 08:24 lacker 阅读(202) 评论(0) 推荐(0)
摘要:``` import java.util.Arrays; / Source : https://oj.leetcode.com/problems/sort colors/ Given an array with n objects colored red, white or blue, sort t 阅读全文
posted @ 2017-10-25 21:42 lacker 阅读(127) 评论(0) 推荐(0)
摘要:``` /** * Source : https://oj.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... 阅读全文
posted @ 2017-10-25 08:25 lacker 阅读(149) 评论(0) 推荐(0)
摘要:``` import java.util.Arrays; / Source : https://oj.leetcode.com/problems/set matrix zeroes/ Given a m x n matrix, if an element is 0, set its entire r 阅读全文
posted @ 2017-10-24 23:25 lacker 阅读(176) 评论(0) 推荐(0)
摘要:``` / Source : https://oj.leetcode.com/problems/edit distance/ Given two words word1 and word2, find the minimum number of steps required to convert w 阅读全文
posted @ 2017-10-24 08:37 lacker 阅读(144) 评论(0) 推荐(0)
摘要:``` import java.util.Stack; / Source : https://oj.leetcode.com/problems/simplify path/ Given an absolute path for a file (Unix style), simplify it. Fo 阅读全文
posted @ 2017-10-23 08:30 lacker 阅读(167) 评论(0) 推荐(0)
摘要:``` / Source : https://oj.leetcode.com/problems/climbing stairs/ You are climbing a stair case. It takes n steps to reach to the top. Each time you ca 阅读全文
posted @ 2017-10-21 08:33 lacker 阅读(142) 评论(0) 推荐(0)
摘要:```java /** * Source : https://oj.leetcode.com/problems/sqrtx/ * * * Implement int sqrt(int x). * * Compute and return the square root of x. */ public class Sqrt { /** * 求x的平方根,这里要求的是... 阅读全文
posted @ 2017-10-20 08:28 lacker 阅读(172) 评论(0) 推荐(0)
摘要:``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; / Source : https://oj.leetcode.com/problems/text justification/ Given 阅读全文
posted @ 2017-10-18 08:23 lacker 阅读(258) 评论(0) 推荐(0)
摘要:``` /** * Source : https://oj.leetcode.com/problems/add-binary/ * * * Given two binary strings, return their sum (also a binary string). * * For example, * a = "11" * b = "1" * Return "100". ... 阅读全文
posted @ 2017-10-17 08:32 lacker 阅读(121) 评论(0) 推荐(0)
摘要:``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Source : https://oj.leetcode.com/problems/plus-one/ * * * Given a non-negative number represented as an array... 阅读全文
posted @ 2017-10-16 23:08 lacker 阅读(122) 评论(0) 推荐(0)
摘要:``` /** * * Source : https://oj.leetcode.com/problems/valid-number/ * * * Validate if a given string is numeric. * * Some examples: * "0" => true * " 0.1 " => true * "abc" => false * "1 ... 阅读全文
posted @ 2017-10-13 08:18 lacker 阅读(149) 评论(0) 推荐(0)
摘要:``` / Source : https://oj.leetcode.com/problems/minimum path sum/ Given a m x n grid filled with non negative numbers, find a path from top left to bo 阅读全文
posted @ 2017-10-12 09:23 lacker 阅读(103) 评论(0) 推荐(0)
摘要:``` /** * Source : https://oj.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 th... 阅读全文
posted @ 2017-10-10 08:09 lacker 阅读(132) 评论(0) 推荐(0)
摘要:``` import java.util.Arrays; / Source : https://oj.leetcode.com/problems/unique paths/ A robot is located at the top left corner of a m x n grid (mark 阅读全文
posted @ 2017-09-30 07:45 lacker 阅读(132) 评论(0) 推荐(0)
摘要:``` / Source : https://oj.leetcode.com/problems/rotate list/ Given a list, rotate the list to the right by k places, where k is non negative. For exam 阅读全文
posted @ 2017-09-27 08:00 lacker 阅读(136) 评论(0) 推荐(0)
摘要:``` import java.util.ArrayList; import java.util.List; /** * Source : https://oj.leetcode.com/problems/permutation-sequence/ * * * The set [1,2,3,…,n] contains a total of n! unique permutations. ... 阅读全文
posted @ 2017-09-26 07:54 lacker 阅读(146) 评论(0) 推荐(0)