Leetcode题目记录
hold_on_
这个作者很懒,什么都没留下…
展开
-
leetcode-1114. 按序打印
题目链接:https://leetcode-cn.com/problems/print-in-order/题目描述:我们提供了一个类:public class Foo { public void first() { print("first"); } public void second() { print("second"); } public void third() { print("third"); }}三个不同的线程 A、B、C 将会共用一个Foo实例。一个将...原创 2021-03-29 15:28:57 · 201 阅读 · 0 评论 -
链表逆序-Java实现
代码:public class TestYou { static class Node{ int str; Node next; Node(int x){ str = x; next = null; } } //主要处理流程 private stat...原创 2020-04-28 10:01:17 · 362 阅读 · 0 评论 -
Leetcode--38. Count and Say--Java
题目:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read ...原创 2019-05-19 17:27:47 · 188 阅读 · 0 评论 -
Leetcode--21. Merge Two Sorted Lists--Java
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example: Input: 1->2->4, 1->3-...原创 2019-05-17 18:04:05 · 234 阅读 · 0 评论 -
Leetcode--26. Remove Duplicates from Sorted Array--Java
题目: Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length. Do not allocate extra space for another array, you must do th...原创 2019-05-18 16:32:20 · 350 阅读 · 0 评论 -
leetcode--300. 最长上升子序列
题目链接:https://leetcode-cn.com/problems/longest-increasing-subsequence/这里只是dp的解法:代码:class Solution { public static int lengthOfLIS(int[] nums) { int length = nums.length; ...原创 2019-08-30 16:04:07 · 129 阅读 · 0 评论