01 2018 档案

摘要:en an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. 阅读全文
posted @ 2018-01-13 19:14 chenhan233 阅读(97) 评论(0) 推荐(0)
摘要:Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = 阅读全文
posted @ 2018-01-13 19:12 chenhan233 阅读(103) 评论(0) 推荐(0)
摘要:There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the 阅读全文
posted @ 2018-01-13 19:11 chenhan233 阅读(183) 评论(0) 推荐(0)
摘要:Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Follow up:Wha 阅读全文
posted @ 2018-01-13 19:10 chenhan233 阅读(97) 评论(0) 推荐(0)
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2018-01-13 19:07 chenhan233 阅读(109) 评论(0) 推荐(0)
摘要:Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t 阅读全文
posted @ 2018-01-13 19:06 chenhan233 阅读(99) 评论(0) 推荐(0)
摘要:There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have t 阅读全文
posted @ 2018-01-13 19:04 chenhan233 阅读(98) 评论(0) 推荐(0)
摘要:Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could 阅读全文
posted @ 2018-01-13 19:02 chenhan233 阅读(150) 评论(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-01-13 19:01 chenhan233 阅读(133) 评论(0) 推荐(0)
摘要:Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given 阅读全文
posted @ 2018-01-13 18:59 chenhan233 阅读(95) 评论(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-01-13 18:57 chenhan233 阅读(109) 评论(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-01-13 18:55 chenhan233 阅读(118) 评论(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", t = 阅读全文
posted @ 2018-01-13 18:54 chenhan233 阅读(82) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: class Solutio 阅读全文
posted @ 2018-01-13 18:53 chenhan233 阅读(84) 评论(0) 推荐(0)
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2018-01-13 18:51 chenhan233 阅读(107) 评论(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 has a g 阅读全文
posted @ 2018-01-13 18:49 chenhan233 阅读(89) 评论(0) 推荐(0)
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa 阅读全文
posted @ 2018-01-13 18:47 chenhan233 阅读(98) 评论(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 nums1' 阅读全文
posted @ 2018-01-13 18:45 chenhan233 阅读(72) 评论(0) 推荐(0)
摘要:Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front 阅读全文
posted @ 2018-01-13 18:43 chenhan233 阅读(99) 评论(0) 推荐(0)
摘要:You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates' id. 阅读全文
posted @ 2018-01-13 18:39 chenhan233 阅读(141) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums 阅读全文
posted @ 2018-01-13 18:37 chenhan233 阅读(131) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 阅读全文
posted @ 2018-01-13 18:36 chenhan233 阅读(92) 评论(0) 推荐(0)
摘要:iven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in ord 阅读全文
posted @ 2018-01-13 18:35 chenhan233 阅读(101) 评论(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-01-13 18:34 chenhan233 阅读(111) 评论(0) 推荐(0)
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might 阅读全文
posted @ 2018-01-13 18:32 chenhan233 阅读(69) 评论(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 find 阅读全文
posted @ 2018-01-13 18:30 chenhan233 阅读(84) 评论(0) 推荐(0)
摘要:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2018-01-13 18:28 chenhan233 阅读(123) 评论(0) 推荐(0)
摘要:Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th 阅读全文
posted @ 2018-01-13 18:25 chenhan233 阅读(113) 评论(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-01-13 18:24 chenhan233 阅读(139) 评论(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. Your t 阅读全文
posted @ 2018-01-13 18:23 chenhan233 阅读(118) 评论(0) 推荐(0)