摘要: 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 阅读(94) 评论(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 阅读(100) 评论(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 阅读(172) 评论(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 阅读(94) 评论(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 阅读(105) 评论(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 阅读(96) 评论(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 阅读(92) 评论(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 阅读(147) 评论(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 阅读(129) 评论(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 阅读(93) 评论(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 阅读(101) 评论(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 阅读(115) 评论(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 阅读(79) 评论(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 阅读(83) 评论(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 阅读(105) 评论(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 阅读(85) 评论(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 阅读(96) 评论(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 阅读(96) 评论(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 阅读(138) 评论(0) 推荐(0) 编辑