随笔分类 - Lintcode
Lintcode: Nuts & Bolts Problem
摘要:Quick Sort Way: We can use quick sort technique to solve this. We represent nuts and bolts in character array for understanding the logic. Nuts repres
阅读全文
Lintcode: Subtree
摘要:You have two every large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of
阅读全文
Lintcode: Expression Evaluation (Basic Calculator III)
摘要:Given an expression string array, return the final result of this expression Have you met this question in a real interview? Yes Example For the expre
阅读全文
Lintcode: Count of Smaller Number
摘要:Give you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) and an query list. For each query, give you
阅读全文
Lintcode: Interval Sum II
摘要:Given an integer array in the construct method, implement two methods query(start, end) and modify(index, value): For query(start, end), return the su
阅读全文
Lintcode: Interval Sum
摘要:Given an integer array (index from 0 to n-1, where n is the size of this array), and an query list. Each query has two integers [start, end]. For each
阅读全文
Lintcode: Interval Minimum Number
摘要:Given an integer array (index from 0 to n-1, where n is the size of this array), and an query list. Each query has two integers [start, end]. For each
阅读全文
Lintcode: Segment Tree Query II
摘要:For an array, we can build a SegmentTree for it, each node stores an extra attribute count to denote the number of elements in the the array which val
阅读全文
Lintcode: Segment Tree Modify
摘要:For a Maximum Segment Tree, which each node has an extra value max to store the maximum value in this node's interval. Implement a modify function wit
阅读全文
Lintcode: Segment Tree Query
摘要:For an integer array (index from 0 to n-1, where n is the size of this array), in the corresponding SegmentTree, each node stores an extra attribute m
阅读全文
Lintcode: Segment Tree Build
摘要:The structure of Segment Tree is a binary tree which each node has two attributes start and end denote an segment / interval. start and end are both i
阅读全文
Lintcode: Matrix Zigzag Traversal
摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in ZigZag-order. Have you met this question in a real intervie
阅读全文
Lintcode: Kth Smallest Number in Sorted Matrix
摘要:Find the kth smallest number in at row and column sorted matrix.ExampleGiven k =4and a matrix:[ [1 ,5 ,7], [3 ,7 ,8], [4 ,8 ,9],]return5ChallengeKL...
阅读全文
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...
阅读全文
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 ...
阅读全文
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...
阅读全文
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...
阅读全文
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...
阅读全文
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...
阅读全文