04 2018 档案

摘要:[抄题]: A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to conve 阅读全文
posted @ 2018-04-30 22:39 苗妙苗 阅读(256) 评论(0) 推荐(0)
摘要:[抄题]: Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is a 阅读全文
posted @ 2018-04-30 17:02 苗妙苗 阅读(229) 评论(0) 推荐(0)
摘要:[抄题]: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i h 阅读全文
posted @ 2018-04-30 15:36 苗妙苗 阅读(148) 评论(0) 推荐(0)
摘要:[抄题]: Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is 阅读全文
posted @ 2018-04-30 10:00 苗妙苗 阅读(150) 评论(0) 推荐(0)
摘要:[抄题]: 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 a 阅读全文
posted @ 2018-04-29 21:50 苗妙苗 阅读(172) 评论(0) 推荐(0)
摘要:[抄题]: An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate 阅读全文
posted @ 2018-04-29 16:58 苗妙苗 阅读(343) 评论(0) 推荐(0)
摘要:[抄题]: You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Each round's operation is p 阅读全文
posted @ 2018-04-29 15:51 苗妙苗 阅读(299) 评论(0) 推荐(0)
摘要:[抄题]: You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for  阅读全文
posted @ 2018-04-29 09:42 苗妙苗 阅读(148) 评论(0) 推荐(0)
摘要:[抄题]: Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the 阅读全文
posted @ 2018-04-28 21:51 苗妙苗 阅读(190) 评论(0) 推荐(0)
摘要:[抄题]: Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are g 阅读全文
posted @ 2018-04-28 11:19 苗妙苗 阅读(115) 评论(0) 推荐(0)
摘要:[抄题]: Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library f 阅读全文
posted @ 2018-04-28 10:06 苗妙苗 阅读(139) 评论(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 阅读全文
posted @ 2018-04-27 22:07 苗妙苗 阅读(201) 评论(0) 推荐(0)
摘要:[抄题]: Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences 阅读全文
posted @ 2018-04-27 16:01 苗妙苗 阅读(121) 评论(0) 推荐(0)
摘要:[抄题]: A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a nu 阅读全文
posted @ 2018-04-27 11:07 苗妙苗 阅读(217) 评论(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 ot 阅读全文
posted @ 2018-04-27 09:09 苗妙苗 阅读(153) 评论(0) 推荐(0)
摘要:[抄题]: Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You nee 阅读全文
posted @ 2018-04-26 15:45 苗妙苗 阅读(149) 评论(0) 推荐(0)
摘要:[抄题]: We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an intege 阅读全文
posted @ 2018-04-26 10:58 苗妙苗 阅读(141) 评论(0) 推荐(0)
摘要:[抄题]: he set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to anot 阅读全文
posted @ 2018-04-25 21:59 苗妙苗 阅读(159) 评论(0) 推荐(0)
摘要:[抄题]: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters 阅读全文
posted @ 2018-04-25 21:06 苗妙苗 阅读(105) 评论(0) 推荐(0)
摘要:[抄题]: Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True, "carerac" -> True. 阅读全文
posted @ 2018-04-25 16:32 苗妙苗 阅读(81) 评论(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  阅读全文
posted @ 2018-04-25 15:47 苗妙苗 阅读(133) 评论(0) 推荐(0)
摘要:[抄题]: You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates 阅读全文
posted @ 2018-04-24 21:49 苗妙苗 阅读(135) 评论(0) 推荐(0)
摘要:[抄题]: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy 阅读全文
posted @ 2018-04-24 17:07 苗妙苗 阅读(155) 评论(0) 推荐(0)
摘要:[抄题]: Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear 阅读全文
posted @ 2018-04-24 16:35 苗妙苗 阅读(430) 评论(0) 推荐(0)
摘要:[抄题]: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more lett 阅读全文
posted @ 2018-04-24 16:08 苗妙苗 阅读(222) 评论(0) 推荐(0)
摘要:[抄题]: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a 阅读全文
posted @ 2018-04-24 10:49 苗妙苗 阅读(589) 评论(0) 推荐(0)
摘要:[抄题]: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occ 阅读全文
posted @ 2018-04-23 23:55 苗妙苗 阅读(152) 评论(0) 推荐(0)
摘要:[抄题]: Count the number of prime numbers less than a non-negative number, n. [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 阅读全文
posted @ 2018-04-23 22:13 苗妙苗 阅读(382) 评论(0) 推荐(0)
摘要:[抄题]: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat 阅读全文
posted @ 2018-04-23 21:12 苗妙苗 阅读(123) 评论(0) 推荐(0)
摘要:[抄题]: Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to 阅读全文
posted @ 2018-04-23 16:28 苗妙苗 阅读(95) 评论(0) 推荐(0)
摘要:[抄题]: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizonta 阅读全文
posted @ 2018-04-23 15:35 苗妙苗 阅读(120) 评论(0) 推荐(0)
摘要:[抄题]: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive 阅读全文
posted @ 2018-04-23 10:37 苗妙苗 阅读(107) 评论(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 Sis a type of 阅读全文
posted @ 2018-04-23 09:35 苗妙苗 阅读(117) 评论(0) 推荐(0)
摘要:[抄题]: Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) a 阅读全文
posted @ 2018-04-22 22:30 苗妙苗 阅读(134) 评论(0) 推荐(0)
摘要:[抄题]: Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the s 阅读全文
posted @ 2018-04-22 16:54 苗妙苗 阅读(97) 评论(0) 推荐(0)
摘要:[抄题]: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots 阅读全文
posted @ 2018-04-22 15:50 苗妙苗 阅读(141) 评论(0) 推荐(0)
摘要:[抄题]: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array wi 阅读全文
posted @ 2018-04-22 09:22 苗妙苗 阅读(110) 评论(0) 推荐(0)
摘要:[抄题]: In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as m 阅读全文
posted @ 2018-04-22 08:49 苗妙苗 阅读(113) 评论(0) 推荐(0)
摘要:[抄题]: Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to outp 阅读全文
posted @ 2018-04-21 22:33 苗妙苗 阅读(324) 评论(0) 推荐(0)
摘要:[抄题]: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time co 阅读全文
posted @ 2018-04-21 21:29 苗妙苗 阅读(621) 评论(0) 推荐(0)
摘要:[抄题]: Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Example 2: [暴力解法]: 时间分析 阅读全文
posted @ 2018-04-21 16:22 苗妙苗 阅读(126) 评论(0) 推荐(0)
摘要:[抄题]: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is no 阅读全文
posted @ 2018-04-21 15:49 苗妙苗 阅读(130) 评论(0) 推荐(0)
摘要:[抄题]: Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes t 阅读全文
posted @ 2018-04-21 10:31 苗妙苗 阅读(170) 评论(0) 推荐(0)
摘要:[抄题]: Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example,Assume that w 阅读全文
posted @ 2018-04-21 09:19 苗妙苗 阅读(178) 评论(0) 推荐(0)
摘要:[抄题]: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: [暴力解法]: 用temp,result,结果发现写起来很麻烦 时间分析: 空间分析: [优化后]: 时间分 阅读全文
posted @ 2018-04-20 22:11 苗妙苗 阅读(166) 评论(0) 推荐(0)
摘要:[抄题]: A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if 阅读全文
posted @ 2018-04-20 21:05 苗妙苗 阅读(600) 评论(0) 推荐(0)
摘要:[抄题]: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original 阅读全文
posted @ 2018-04-18 22:33 苗妙苗 阅读(257) 评论(0) 推荐(0)
摘要:[抄题]: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. 阅读全文
posted @ 2018-04-18 16:28 苗妙苗 阅读(176) 评论(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  阅读全文
posted @ 2018-04-18 15:21 苗妙苗 阅读(146) 评论(0) 推荐(0)
摘要:[抄题]: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4 阅读全文
posted @ 2018-04-18 10:38 苗妙苗 阅读(112) 评论(0) 推荐(0)
摘要:[抄题]: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [ 阅读全文
posted @ 2018-04-17 22:17 苗妙苗 阅读(115) 评论(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 [暴力解法] 阅读全文
posted @ 2018-04-17 15:14 苗妙苗 阅读(120) 评论(0) 推荐(0)
摘要:[抄题]: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩 阅读全文
posted @ 2018-04-16 15:19 苗妙苗 阅读(145) 评论(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 t 阅读全文
posted @ 2018-04-15 16:17 苗妙苗 阅读(118) 评论(0) 推荐(0)
摘要:[抄题]: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as a 阅读全文
posted @ 2018-04-15 10:28 苗妙苗 阅读(133) 评论(0) 推荐(0)
摘要:[抄题]: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For exampl 阅读全文
posted @ 2018-04-14 21:48 苗妙苗 阅读(96) 评论(0) 推荐(0)