leetcode
这个昵称有十五个字不信你数数
我有点可爱哈哈哈哈哈哈哈
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[LeetCode 1115] 交替打印FooBar
[LeetCode 1115] 交替打印FooBar我们提供一个类:class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n; i++) { print("bar"); } }}两个不同的线程将会共用一个 FooBar原创 2020-10-08 12:24:48 · 332 阅读 · 0 评论 -
[LeetCode] 51. N皇后 (java)
n皇后问题研究的是如何将 n个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。给定一个整数 n,返回所有不同的n皇后问题的解决方案。每一种解法包含一个明确的n 皇后问题的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。示例:输入: 4输出: [[".Q..", // 解法 1 "...Q", "Q...", "..Q."],["..Q.", // 解法 2 "Q...", "...Q", ".Q.."]]解...原创 2020-05-28 16:37:33 · 347 阅读 · 0 评论 -
[LeetCode] 600. Non-negative Integers without Consecutive Ones (java)
Given a positive integer n, find the number ofnon-negativeintegers less than or equal to n, whose binary representations do NOT containconsecutive ones.Example 1:Input: 5Output: 5Explanation...原创 2020-03-07 11:46:00 · 191 阅读 · 0 评论 -
[LeetCode] 592. Fraction Addition and Subtraction (java)
Given a string representing an expression of fraction addition and subtraction, you need to return the calculation result in string format. The final result should beirreducible fraction. If your fin...原创 2020-02-27 13:22:07 · 229 阅读 · 0 评论 -
[LeetCode] 143. Reorder List
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-...原创 2020-01-05 19:39:57 · 153 阅读 · 0 评论 -
[LeetCode] 95. Unique Binary Search Trees II(Java)
Given an integern, generate all structurally uniqueBST's(binary search trees) that store values 1 ...n.Example:Input: 3Output:[ [1,null,3,2], [3,2,null,1], [3,1,null,null,2], [2,1,3...原创 2020-01-01 22:47:12 · 189 阅读 · 0 评论 -
[LeetCode] 61. Rotate List
Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->NULLExplan...原创 2019-12-29 11:13:55 · 140 阅读 · 0 评论 -
[LeetCode] 57. Insert Interval(Java)
Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp...原创 2019-12-28 22:39:24 · 317 阅读 · 0 评论 -
[LeetCode] 1116. Print Zero Even Odd
Suppose you are given the following code:class ZeroEvenOdd { public ZeroEvenOdd(int n) { ... } // constructor public void zero(printNumber) { ... } // only output 0's public void even(p...原创 2019-09-12 17:58:11 · 633 阅读 · 0 评论 -
[LeetCode] 1115. Print FooBar Alternately
Suppose you are given the following code:class FooBar { public void foo() { for (int i = 0; i < n; i++) { print("foo"); } } public void bar() { for (int i = 0; i < n;...原创 2019-09-11 12:03:24 · 426 阅读 · 0 评论 -
[LeetCode] 1114. Print in Order
利用volatile关键字方法关于volatile关键字的解析可查看:https://blog.youkuaiyun.com/liuwenyou/article/details/100690719private volatile boolean firstflag,secondflag; public Foo() { } public void first...原创 2019-09-10 10:55:28 · 273 阅读 · 0 评论 -
[LeetCode] 264. Ugly Number II
Write a program to find then-th ugly number.Ugly numbers arepositive numberswhose prime factors only include2, 3, 5.Example:Input: n = 10Output: 12Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10...原创 2019-09-07 21:02:39 · 196 阅读 · 0 评论 -
[LeetCode] 263. Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers arepositive numberswhose prime factors only include2, 3, 5.Example 1:Input: 6Output: trueExplanation: 6 = 2 ×...原创 2019-09-07 20:14:03 · 197 阅读 · 0 评论 -
[LeetCode] 239. Sliding Window Maximum
239.Sliding Window MaximumGiven an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Ea...原创 2019-09-04 10:35:58 · 150 阅读 · 0 评论
分享