Leetcode
文章平均质量分 81
tiefanhe
这个作者很懒,什么都没留下…
展开
-
Leetcode[2] Add Two Numbers
You are given two linkedlists representing two non-negative numbers. The digits are stored in reverseorder and each of their nodes contain a single digit. Add the two numbers andreturn it as a linke原创 2015-04-29 11:30:46 · 327 阅读 · 0 评论 -
808. Soup Servings
There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations:Serve 100 ml of soup A and 0 ml of soup BServe 75 ml of soup A and 25 ml...原创 2018-05-02 13:44:57 · 354 阅读 · 0 评论 -
807. Max Increase to Keep City Skyline
In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can...原创 2018-05-02 12:42:36 · 362 阅读 · 0 评论 -
806. Number of Lines To Write String
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it...原创 2018-05-01 13:51:17 · 161 阅读 · 0 评论 -
[leetcode 804] Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.For原创 2018-04-16 12:39:26 · 189 阅读 · 0 评论 -
[leetcode 803] Bricks Falling When Hit
We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent bricks wi...原创 2018-04-16 10:38:24 · 873 阅读 · 0 评论 -
[leetcode 802] Find Eventual Safe States
In a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node that is terminal (that is, it has no outgoing directed edges), we stop.Now, say ...原创 2018-04-16 09:24:17 · 633 阅读 · 0 评论 -
[leetcode 801] Minimum Swaps To Make Sequences Increasing
801. Minimum Swaps To Make Sequences IncreasingWe have two integer sequences A and B of the same non-zero length.We are allowed to swap elements A[i] and B[i]. Note that both elements are in the same...原创 2018-04-16 08:14:18 · 376 阅读 · 0 评论 -
Leetcode[4] Median of Two Sorted Arrays
There are two sorted arraysA and B of size m and n respectively. Find the median of the two sorted arrays.The overall run time complexity should be O(log (m+n)).C++版本double findMedianSortedArr原创 2015-05-07 22:30:13 · 382 阅读 · 0 评论 -
Leetcode[3] Longest Substring Without Repeating Characters
Given astring, find the length of the longest substring without repeating characters.For example, the longest substring without repeating letters for"abcabcbb" is "abc", which the length is 3. For"bbb原创 2015-05-07 21:41:59 · 411 阅读 · 0 评论 -
Leetcode[1] Two Sum
Givenan array of integers, find two numbers such that they add up to a specifictarget numberThefunction twoSum should return indices of the two numbers such that they addup to the target, whereind原创 2015-04-28 17:17:20 · 349 阅读 · 0 评论 -
809. Expressive Words
Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". Here, we have groups, of adjacent letters that are all the same character, and adjac...原创 2018-05-02 14:24:57 · 530 阅读 · 0 评论