1.3k words 1 mins.

28 · Search a 2D Matrix - LintCode # Description Write an efficient algorithm that searches for a target value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each row is greater than the last integer of the...
1.3k words 1 mins.

447 · Search in a Big Sorted Array - LintCode # Description Given a big sorted array with non-negative integers sorted by non-decreasing order. The array is so big so that you can not get the length of the whole array directly, and you can only access the kth number by ArrayReader.get(k) (or...
1.4k words 1 mins.

155 · Minimum Depth of Binary Tree - LintCode # Description Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. # Example Example 1: Input: {} Output: 0 Example 2: Input:...
837 words 1 mins.

97 · Maximum Depth of Binary Tree - LintCode # Description Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. The answer will not exceed 5000 # Example Example 1: Input: tree =...
1.3k words 1 mins.

71 · Binary Tree Zigzag Level Order Traversal - LintCode # Description Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). # Example Example 1: Input: tree =...
1.5k words 1 mins.

package com.tiffanyiong;import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class Main { public static void main(String[] args){ int n = 5; // 結點個數 String vertices[] = {"A", "B", "C", "D",...
1.4k words 1 mins.

521 · Remove Duplicate Numbers in Array - LintCode # Description Given an array of integers, remove the duplicate numbers in it. You should: Do it in place in the array. Put the element after removing the repetition at the beginning of the array. Return the number of elements after removing...
13k words 12 mins.

Customer obsession “Leaders start with the customer and work backwards. They work vigorously to earn and keep customer trust. Although leaders pay attention to competitors, they obsess over customers.” • Tell me about one of your projects where you put the customer first • Tell me about a time you...
1.3k words 1 mins.

760 · Binary Tree Right Side View - LintCode # Description Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom Example Example 1 Input: {1,2,3,#,5,#,4} Output: [1,3,4] Explanation: 1 / \ 2...
881 words 1 mins.

604 · Window Sum - LintCode # Description Given an array of n integers, and a moving window(size k), move the window at each iteration from the start of the array, find the sum of the element inside the window at each moving. # Example Example 1 Input:array = [1,2,7,8,5], k =...