随笔分类 -  LintCode

摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Given n points on a 2D plane, find the maximum num 阅读全文
posted @ 2017-01-10 14:29 Grandyang 阅读(1074) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. Notice If the two linked lists have no intersection at a 阅读全文
posted @ 2017-01-04 11:56 Grandyang 阅读(750) 评论(0) 推荐(0) 编辑
摘要:Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the 阅读全文
posted @ 2017-01-03 06:09 Grandyang 阅读(715) 评论(0) 推荐(0) 编辑
摘要: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 comple 阅读全文
posted @ 2017-01-01 03:09 Grandyang 阅读(579) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find a contiguous subarray which has the largest sum. Notice The subarray should contain at least one number. Have you met 阅读全文
posted @ 2016-12-31 08:09 Grandyang 阅读(1523) 评论(0) 推荐(0) 编辑
摘要:Write an algorithm which computes the number of trailing zeros in n factorial. Have you met this question in a real interview? Yes Write an algorithm 阅读全文
posted @ 2016-12-19 23:30 Grandyang 阅读(888) 评论(0) 推荐(0) 编辑
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2016-12-12 23:03 Grandyang 阅读(959) 评论(0) 推荐(0) 编辑
摘要:Given k strings, find the longest common prefix (LCP). Given k strings, find the longest common prefix (LCP). Have you met this question in a real int 阅读全文
posted @ 2016-12-05 10:30 Grandyang 阅读(771) 评论(0) 推荐(0) 编辑
摘要:Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. Have you met this question 阅读全文
posted @ 2016-12-04 23:28 Grandyang 阅读(510) 评论(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 @ 2016-12-03 23:37 Grandyang 阅读(701) 评论(0) 推荐(0) 编辑
摘要:Sort a linked list in O(n log n) time using constant space complexity. Have you met this question in a real interview? Yes Sort a linked list in O(n l 阅读全文
posted @ 2016-12-02 23:40 Grandyang 阅读(2308) 评论(0) 推荐(0) 编辑
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2016-12-01 13:52 Grandyang 阅读(185) 评论(0) 推荐(0) 编辑
摘要:There is an integer array which has the following features: The numbers in adjacent positions are different. A[0] < A[1] && A[A.length - 2] > A[A.leng 阅读全文
posted @ 2016-11-30 12:00 Grandyang 阅读(1101) 评论(0) 推荐(0) 编辑
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2016-11-29 23:57 Grandyang 阅读(1241) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, determine if it has a cycle in it. ExampleGiven -21->10->4->5, tail connects to node index 1, return true Challenge Follow up:Can 阅读全文
posted @ 2016-11-29 23:50 Grandyang 阅读(494) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it. Notice You may assume that 阅读全文
posted @ 2016-11-16 11:58 Grandyang 阅读(851) 评论(0) 推荐(0) 编辑
摘要:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". Have you met this question i 阅读全文
posted @ 2016-11-15 14:20 Grandyang 阅读(2000) 评论(0) 推荐(0) 编辑
摘要:Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c 阅读全文
posted @ 2016-11-14 06:28 Grandyang 阅读(832) 评论(0) 推荐(0) 编辑
摘要:Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node. Implement an algorithm to delete a node 阅读全文
posted @ 2016-11-08 10:54 Grandyang 阅读(499) 评论(0) 推荐(0) 编辑
摘要:You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1's 阅读全文
posted @ 2016-11-07 08:02 Grandyang 阅读(854) 评论(0) 推荐(0) 编辑

Fork me on GitHub