• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页
2016年1月11日
FB面经prepare: Task Schedule
摘要: 每种task都有冷却时间,比如task1执行后,要经过interval时间后才能再次执行,求总共所需时间。用HashMap保存每一个task的下一次可以开始执行的最早时间 1 package TaskSchedule; 2 import java.util.*; 3 4 public class ... 阅读全文
posted @ 2016-01-11 07:09 neverlandly 阅读(1633) 评论(0) 推荐(0)
FB面经prepare: find k cloest points to a given point in 2D plane
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2016-01-11 04:40 neverlandly 阅读(11) 评论(0) 推荐(0)
2016年1月9日
Lintcode: Minimum Subarray
摘要: Given an array of integers, find the subarray with smallest sum.Return the sum of the subarray.Have you met this question in a real interview? YesExam... 阅读全文
posted @ 2016-01-09 06:09 neverlandly 阅读(262) 评论(0) 推荐(0)
Leetcode: Power of Three
摘要: Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursion? Recursion: 1 阅读全文
posted @ 2016-01-09 04:32 neverlandly 阅读(5857) 评论(0) 推荐(0)
2016年1月6日
Lintcode: Permutation Index II
摘要: Given a permutation which may contain repeated numbers, find its index in all the permutations of these numbers, which are ordered in lexicographical ... 阅读全文
posted @ 2016-01-06 09:11 neverlandly 阅读(1315) 评论(0) 推荐(0)
Lintcode: Permutation Index
摘要: Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical o... 阅读全文
posted @ 2016-01-06 07:56 neverlandly 阅读(2053) 评论(0) 推荐(0)
Lintcode: Wood Cut
摘要: Given n pieces of wood with length L[i] (integer array). Cut them into small pieces to guarantee you could have equal or more than k pieces with the s... 阅读全文
posted @ 2016-01-06 05:59 neverlandly 阅读(1015) 评论(0) 推荐(0)
Lintcode: Update Bits
摘要: Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M becomes a s... 阅读全文
posted @ 2016-01-06 05:20 neverlandly 阅读(567) 评论(0) 推荐(0)
Lintcode: Route Between Two Nodes in Graph
摘要: Given a directed graph, design an algorithm to find out whether there is a route between two nodes.Have you met this question in a real interview? Yes... 阅读全文
posted @ 2016-01-06 04:58 neverlandly 阅读(710) 评论(0) 推荐(0)
Lintcode: Flip Bits
摘要: Determine the number of bits required to flip if you want to convert integer n to integer m.Have you met this question in a real interview? YesExample... 阅读全文
posted @ 2016-01-06 04:34 neverlandly 阅读(501) 评论(0) 推荐(0)
Leetcode: Maximum Size Subarray Sum Equals k
摘要: Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.Example 1:Given n... 阅读全文
posted @ 2016-01-06 04:20 neverlandly 阅读(7425) 评论(0) 推荐(0)
2016年1月5日
Lintcode: Subarray Sum Closest
摘要: Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number.Have you met this question in... 阅读全文
posted @ 2016-01-05 11:39 neverlandly 阅读(1419) 评论(0) 推荐(0)
Lintcode: Remove Node in Binary Search Tree
摘要: iven a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value in t... 阅读全文
posted @ 2016-01-05 07:36 neverlandly 阅读(466) 评论(0) 推荐(0)
Lintcode: Majority Number III
摘要: Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array.Find it.Have you met t... 阅读全文
posted @ 2016-01-05 05:57 neverlandly 阅读(560) 评论(0) 推荐(0)
2016年1月2日
Leetcode: Range Sum Query - Mutable && Summary: Segment Tree
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by upda... 阅读全文
posted @ 2016-01-02 13:48 neverlandly 阅读(493) 评论(0) 推荐(0)
Leetcode: Create Maximum Number
摘要: Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k 0 && n-i-1>=count-j && res[j-1]arr2... 阅读全文
posted @ 2016-01-02 10:17 neverlandly 阅读(2969) 评论(0) 推荐(0)
Leetcode: Maximum Product of Word Lengths
摘要: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum... 阅读全文
posted @ 2016-01-02 07:13 neverlandly 阅读(501) 评论(0) 推荐(0)
Leetcode: Shortest Distance from All Buildings
摘要: Adopted approach: start from each building, try to reach all 0. Alternertive approch can be start from each 0, try to reach all buildings. Which is wa 阅读全文
posted @ 2016-01-02 05:53 neverlandly 阅读(3222) 评论(0) 推荐(0)
Leetcode: Remove Duplicate Letters
摘要: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your... 阅读全文
posted @ 2016-01-02 02:18 neverlandly 阅读(952) 评论(0) 推荐(0)
2016年1月1日
Leetcode: Count of Smaller Numbers After Self
摘要: You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smal 阅读全文
posted @ 2016-01-01 14:26 neverlandly 阅读(533) 评论(0) 推荐(0)
Leetcode: Binary Tree Vertical Order Traversal
摘要: Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).If two nodes are in the same... 阅读全文
posted @ 2016-01-01 11:44 neverlandly 阅读(819) 评论(0) 推荐(0)
Leetcode: Bulb Switcher
摘要: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every ... 阅读全文
posted @ 2016-01-01 07:53 neverlandly 阅读(386) 评论(0) 推荐(0)
Leetcode: Super Ugly Number
摘要: Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes o... 阅读全文
posted @ 2016-01-01 07:21 neverlandly 阅读(412) 评论(0) 推荐(0)
Leetcode: Burst Balloons
摘要: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloon... 阅读全文
posted @ 2016-01-01 06:37 neverlandly 阅读(608) 评论(0) 推荐(0)
Leetcode: Minimum Height Trees
摘要: Hint: build graph first, also buil indegree array, then find leaf and remove them among their neighbors, level by level. Until left less 2 nodes 这道题跟一 阅读全文
posted @ 2016-01-01 02:39 neverlandly 阅读(806) 评论(0) 推荐(0)
Leetcode: Generalized Abbreviation
摘要: Write a function to generate the generalized abbreviations of a word.Example:Given word = "word", return the following list (order does not matter):["... 阅读全文
posted @ 2016-01-01 01:07 neverlandly 阅读(5486) 评论(0) 推荐(0)
2015年12月31日
Leetcode: Coin Change
摘要: You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee... 阅读全文
posted @ 2015-12-31 14:07 neverlandly 阅读(366) 评论(0) 推荐(0)
Leetcode: Best Time to Buy and Sell Stock with Cooldown
摘要: Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2015-12-31 13:15 neverlandly 阅读(870) 评论(0) 推荐(0)
Leetcode: Sparse Matrix Multiplication
摘要: Given two sparse matrices A and B, return the result of AB.You may assume that A's column number is equal to B's row number.Example:A = [ [ 1, 0, 0],... 阅读全文
posted @ 2015-12-31 07:57 neverlandly 阅读(2555) 评论(0) 推荐(0)
Leetcode: Expression Add Operators
摘要: 参考http://segmentfault.com/a/1190000003797204 and http://blog.csdn.net/u013027996/article/details/48713751 深度优先搜索 复杂度 时间 O(N^2) 空间 O(N) 思路 因为要输出所有可能的情况 阅读全文
posted @ 2015-12-31 07:13 neverlandly 阅读(331) 评论(0) 推荐(0)
Leetcode: Remove Invalid Parentheses
摘要: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may cont 阅读全文
posted @ 2015-12-31 02:34 neverlandly 阅读(1484) 评论(0) 推荐(0)
2015年12月30日
Leetcode: Number of Connected Components in an Undirected Graph
摘要: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected ... 阅读全文
posted @ 2015-12-30 13:04 neverlandly 阅读(2906) 评论(0) 推荐(0)
Leetcode: Number of Islands II && Summary of Union Find
摘要: Union Find Princeton's lecture note on Union Find in Algorithms and Data Structures It is a well organized note with clear illustration describing fro 阅读全文
posted @ 2015-12-30 08:09 neverlandly 阅读(3758) 评论(0) 推荐(0)
Leetcode: Additive Number
摘要: Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the f 阅读全文
posted @ 2015-12-30 05:13 neverlandly 阅读(324) 评论(0) 推荐(0)
2015年12月29日
Leetcode: Range Sum Query 2D - Immutable
摘要: 阅读全文
posted @ 2015-12-29 09:25 neverlandly 阅读(323) 评论(0) 推荐(0)
Leetcode: Range Sum Query - Immutable
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumR 阅读全文
posted @ 2015-12-29 08:56 neverlandly 阅读(231) 评论(0) 推荐(0)
Leetcode: Smallest Rectangle Enclosing Black Pixels
摘要: An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one bla 阅读全文
posted @ 2015-12-29 08:28 neverlandly 阅读(943) 评论(0) 推荐(0)
Leetcode: Longest Increasing Subsequence
摘要: 讲解一: 用一个数组来存 the smallest tail of all increasing subsequences with length i+1 in tails[i]. For example, say we have nums = [4,5,6,3], then all the ava 阅读全文
posted @ 2015-12-29 06:07 neverlandly 阅读(429) 评论(0) 推荐(0)
Leetcode: Bulls and Cows
摘要: Be careful, when calculate B, you should exclude A's cases 阅读全文
posted @ 2015-12-29 04:52 neverlandly 阅读(338) 评论(0) 推荐(0)
Leetcode: Serialize and Deserialize Binary Tree
摘要: Referring this post: https://leetcode.com/problems/serialize-and-deserialize-binary-tree/discuss/74253/Easy-to-understand-Java-Solution But instead us 阅读全文
posted @ 2015-12-29 03:16 neverlandly 阅读(378) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3