摘要:
Find the sum of all left leaves in a given binary tree. Example: 阅读全文
摘要:
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
摘要:
一个sequence,里面都是整数,求最长的subsequence的长度,使得这个subsquence的最大值和最小值相差不超过1. 比如[1,3,2,2,5,2,3,7]最长的subsequence是[3,2,2,2,3],所以应该返回5. 分析: 这题可以先排序,然后找出两个相差1的相邻值的最大 阅读全文
摘要:
Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. 阅读全文
摘要:
Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Example 2: 阅读全文
摘要:
给你一个字符串和字典,从头扫到位,如果到当前的字符的字符串存在于字典中,则显示 buzz. 例子: ILOVEPINEAPPLEJUICE 字典: [pine, apple, pineapple, juice, applejuice] 那么当我们到达ILOVEPINE的时候,就要buzz,当我们到达 阅读全文
摘要:
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algor 阅读全文
摘要:
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it up 阅读全文
摘要:
The question and solution are from: http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/ Given a Binary Tree (BT), convert 阅读全文
摘要:
From: https://discuss.leetcode.com/topic/89/write-elevator-program-using-event-driven-programming/9 We can divide into three main components: User Use 阅读全文