随笔分类 - 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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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.
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文