- 博客(12)
- 收藏
- 关注
原创 Average of Levels in Binary Tree
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1:Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11]Explanati...
2018-12-30 13:17:00 124
原创 Merge k Sorted Lists
Mergeksorted linked lists and return it as one sorted list.Analyze and describe its complexity.ExampleExample 1: Input: [2->4->null,null,-1->null] Output: -1->2->4->nul...
2018-12-29 09:13:52 195
原创 Kth Largest Element in a Stream
Design a class to findthekth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.YourKthLargestclass will have a constructor wh...
2018-12-29 07:28:09 429
原创 Top K Frequent Words
Given a non-empty list of words, return thekmost frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with the lo...
2018-12-28 13:59:42 249
原创 Merge Sort Array and Merge Sort Linked List
Merge Sort Array: 看完stanford的 CS106B的video,https://www.youtube.com/watch?v=LlNawf0JeF0&list=PLnfg8b9vdpLn9exZweTJx44CII1bYczuk&index=55醍醐灌顶;public class Solution { /** * @param A:...
2018-12-26 09:02:40 767
原创 Reverse String
Write a function that takes a string as input and returns the string reversed.Example 1:Input: "hello"Output: "olleh"Example 2:Input: "A man, a plan, a canal: Panama"Output: "amanaP :lana...
2018-12-25 13:20:06 106
原创 Merge Two Binary Trees
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree...
2018-12-25 13:14:00 119
原创 Sort Array By Parity
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...
2018-12-25 13:07:08 118
原创 Number of Recent Calls
Write a class RecentCounter to count recent requests.It has only one method: ping(int t), where t represents some time in milliseconds.Return the number of pings that have been made from 3000 mill...
2018-12-25 08:56:41 206
原创 Linked List Components
We are given head, the head node of a linked list containing unique integer values.We are also given the list G, a subset of the values in the linked list.Return the number of connected components...
2018-12-25 08:27:33 229
原创 Design Linked List
Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list should have two attributes: val and next. val is t...
2018-12-24 07:08:02 326
原创 Middle of the Linked List
Find the middle node of a linked list.ExampleExample 1:Input: 1->2->3Output: 2 Explanation: return the value of the middle node.Example 2:Input: 1->2Output: 1 Explanation: ...
2018-12-13 06:11:09 324
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人