随笔分类 -  Google

摘要:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2018-10-17 12:22 一丝清风一抹红尘 阅读(145) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Foll 阅读全文
posted @ 2018-10-16 17:34 一丝清风一抹红尘 阅读(144) 评论(0) 推荐(0)
摘要:Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo 阅读全文
posted @ 2018-10-14 10:11 一丝清风一抹红尘 阅读(128) 评论(0) 推荐(0)
摘要: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 cl 阅读全文
posted @ 2018-10-12 16:42 一丝清风一抹红尘 阅读(133) 评论(0) 推荐(0)
摘要:Given a non-negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers 阅读全文
posted @ 2018-10-12 16:00 一丝清风一抹红尘 阅读(128) 评论(0) 推荐(0)
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文
posted @ 2018-10-12 15:39 一丝清风一抹红尘 阅读(243) 评论(0) 推荐(0)
摘要:Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = 阅读全文
posted @ 2018-10-12 14:32 一丝清风一抹红尘 阅读(343) 评论(0) 推荐(0)
摘要:A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates 阅读全文
posted @ 2018-10-12 12:25 一丝清风一抹红尘 阅读(216) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-10-11 19:21 一丝清风一抹红尘 阅读(100) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example 1: Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [4,9] Exam 阅读全文
posted @ 2018-10-11 19:17 一丝清风一抹红尘 阅读(85) 评论(0) 推荐(0)
摘要:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path betwe 阅读全文
posted @ 2018-10-11 18:46 一丝清风一抹红尘 阅读(118) 评论(0) 推荐(0)
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g 阅读全文
posted @ 2018-10-11 18:14 一丝清风一抹红尘 阅读(150) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Example 2: Note:Your 阅读全文
posted @ 2018-10-11 17:58 一丝清风一抹红尘 阅读(141) 评论(0) 推荐(0)
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2018-10-11 17:21 一丝清风一抹红尘 阅读(110) 评论(0) 推荐(0)
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals 阅读全文
posted @ 2018-10-11 17:00 一丝清风一抹红尘 阅读(107) 评论(0) 推荐(0)
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-10-11 15:34 一丝清风一抹红尘 阅读(92) 评论(0) 推荐(0)
摘要:Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Example 2: Note:You may assume the string contains only 阅读全文
posted @ 2018-10-11 15:25 一丝清风一抹红尘 阅读(106) 评论(0) 推荐(0)
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh 阅读全文
posted @ 2018-10-11 15:11 一丝清风一抹红尘 阅读(141) 评论(0) 推荐(0)
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman numeral, just two one's 阅读全文
posted @ 2018-10-11 14:45 一丝清风一抹红尘 阅读(106) 评论(0) 推荐(0)
摘要:Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 阅读全文
posted @ 2018-10-11 13:58 一丝清风一抹红尘 阅读(120) 评论(0) 推荐(0)