09 2018 档案

摘要:Given a binary tree, return the bottom up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For 阅读全文
posted @ 2018-09-30 20:23 bernieloveslife 阅读(79) 评论(0) 推荐(0)
摘要:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree [ 阅读全文
posted @ 2018-09-30 20:22 bernieloveslife 阅读(104) 评论(0) 推荐(0)
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2018-09-30 20:21 bernieloveslife 阅读(92) 评论(0) 推荐(0)
摘要:Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Exampl 阅读全文
posted @ 2018-09-30 20:21 bernieloveslife 阅读(75) 评论(0) 推荐(0)
摘要:Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1, 阅读全文
posted @ 2018-09-30 20:20 bernieloveslife 阅读(92) 评论(0) 推荐(0)
摘要:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2018-09-29 11:01 bernieloveslife 阅读(84) 评论(0) 推荐(0)
摘要:Count the number of prime numbers less than a non negative number, n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10 阅读全文
posted @ 2018-09-29 11:01 bernieloveslife 阅读(85) 评论(0) 推荐(0)
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文
posted @ 2018-09-29 11:00 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2018-09-29 10:58 bernieloveslife 阅读(86) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E 阅读全文
posted @ 2018-09-29 10:56 bernieloveslife 阅读(106) 评论(0) 推荐(0)
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2018-09-28 11:57 bernieloveslife 阅读(82) 评论(0) 推荐(0)
摘要:At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil 阅读全文
posted @ 2018-09-28 11:57 bernieloveslife 阅读(116) 评论(0) 推荐(0)
摘要:Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: 阅读全文
posted @ 2018-09-28 11:55 bernieloveslife 阅读(96) 评论(0) 推荐(0)
摘要:Reverse bits of a given 32 bits unsigned integer. Example: Input: 43261596 Output: 964176192 Explanation: 43261596 represented in binary as 0000001010 阅读全文
posted @ 2018-09-28 11:54 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non negative integer. Since the return type is an in 阅读全文
posted @ 2018-09-28 11:53 bernieloveslife 阅读(139) 评论(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: Inpu 阅读全文
posted @ 2018-09-27 19:14 bernieloveslife 阅读(91) 评论(0) 推荐(0)
摘要:Validate if a given string can be interpreted as a decimal number. Some examples: "0" = true " 0.1 " = true "abc" = false "1 a" = false "2e10" = true 阅读全文
posted @ 2018-09-27 19:08 bernieloveslife 阅读(129) 评论(0) 推荐(0)
摘要:Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Outp 阅读全文
posted @ 2018-09-27 19:07 bernieloveslife 阅读(115) 评论(0) 推荐(0)
摘要:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
posted @ 2018-09-27 19:07 bernieloveslife 阅读(83) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2018-09-27 19:05 bernieloveslife 阅读(88) 评论(0) 推荐(0)
摘要:Given a non empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4 directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-09-26 16:24 bernieloveslife 阅读(111) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: num 阅读全文
posted @ 2018-09-26 15:46 bernieloveslife 阅读(93) 评论(0) 推荐(0)
摘要:Given a binary search tree with non negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 O 阅读全文
posted @ 2018-09-26 15:36 bernieloveslife 阅读(89) 评论(0) 推荐(0)
摘要:Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non white 阅读全文
posted @ 2018-09-26 15:13 bernieloveslife 阅读(124) 评论(0) 推荐(0)
摘要:Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Example 2: Example 3: 阅读全文
posted @ 2018-09-26 14:20 bernieloveslife 阅读(112) 评论(0) 推荐(0)
摘要: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 n 阅读全文
posted @ 2018-09-25 16:52 bernieloveslife 阅读(135) 评论(0) 推荐(0)
摘要:You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of ston 阅读全文
posted @ 2018-09-25 16:39 bernieloveslife 阅读(116) 评论(0) 推荐(0)
摘要:Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Example 2: Example 3: 阅读全文
posted @ 2018-09-25 16:28 bernieloveslife 阅读(106) 评论(0) 推荐(0)
摘要:Given a 32 bit signed integer, reverse digits of an integer. Note: Assume we are dealing with an environment which could only store integers within th 阅读全文
posted @ 2018-09-25 16:10 bernieloveslife 阅读(89) 评论(0) 推荐(0)
摘要:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2018-09-25 15:41 bernieloveslife 阅读(169) 评论(0) 推荐(0)