摘要:
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest i 阅读全文
摘要:
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For exam 阅读全文
摘要:
206.Reverse Linked List Reverse a singly linked list. Tips:实现从尾到头打印一个链表。 以下代码包括两张方法: ①使用栈实现,不改变原链表。先读入,后输出。典型的先进后出,可用栈来实现。 ②改变原来链表的指针方向。 阅读全文
摘要:
198.HouseRobber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constr 阅读全文
摘要:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
摘要:
72. Edit Distance 72. Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operat 阅读全文
摘要:
62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down 阅读全文
摘要:
面试题3 二维数组中的查找 Leetcode--74 Search a 2D Matrix 1 /*Java 2 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has th 阅读全文
摘要:
java如何对ArrayList中对象按照该对象某属性排序 (从小到大) 两种方法: 调用方法: 调用方法: KNNNode结点内的属性: 我想要按照KNNNode的distance属性排序。 若要按照从大到小的顺序排序,如果只是将 >=返回值改为-1 <返回值改为1 会出现异常。 Comparis 阅读全文
摘要:
Question: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives t 阅读全文