
LeetCode
此号不用,请关注 夜雨柠檬
请关注,夜雨柠檬
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【LeetCode】循环双端队列
class MyCircularDeque { private int front; private int rear; private int size; private int[] arr; private int maxSize; /** Initialize your data structure here. Set the size of...原创 2019-08-06 08:09:55 · 176 阅读 · 0 评论 -
【LeetCode】删除排序数组中的重复项
Java codeclass Solution { public int removeDuplicates(int[] nums) { int count1 = 0; int count2 = 0; int temp = 0; for(int i = 0; i < nums.length - count1; i++) ...原创 2019-08-12 14:44:16 · 139 阅读 · 0 评论 -
【LeetCode】合并两个有序链表
Java codeclass Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode l = new ListNode(0); ListNode temp = l; while(l1 != null && l...原创 2019-08-12 11:22:48 · 127 阅读 · 0 评论 -
【LeetCode】罗马数字转整数
Java codeclass Solution { public int romanToInt(String s) { int sum = 0; char[] c = s.toCharArray(); for(int i = 0; i < c.length; i++) { if(c[i] == 'I') { ...原创 2019-08-07 15:37:50 · 121 阅读 · 0 评论 -
【LeetCode】整数反转
Java codeclass Solution { public int reverse(int x) { boolean flag = false; if(x < 0) { flag = true; x = -x; } String s1 = Integer.toStr...原创 2019-08-07 12:31:18 · 92 阅读 · 0 评论 -
【LeetCode】反转链表Ⅱ
Java code/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */class Solution { public ListNode r...原创 2019-08-09 14:08:02 · 139 阅读 · 0 评论 -
【LeetCode】回文数
Java codeclass Solution { public boolean isPalindrome(int x) { String s = Integer.toString(x); char[] c = s.toCharArray(); int i = 0; int j = 0; for(; i &l...原创 2019-08-07 09:00:10 · 96 阅读 · 0 评论 -
【LeetCode】两数相加
Java codeclass Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { int n = 0; int n1 = 0; int n2 = 0; int m = 0; ListNode temp = new ListN...原创 2019-08-07 08:15:39 · 102 阅读 · 0 评论 -
【LeetCode】反转链表
Java code/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */class Solution { public ListNode r...原创 2019-08-08 20:31:09 · 163 阅读 · 0 评论 -
【LeetCode】两数之和
Java codeclass Solution { public int[] twoSum(int[] nums, int target) { for(int i = 0; i < nums.length - 1; i++) { for(int j = i + 1; j < nums.length; j++) { ...原创 2019-08-06 18:57:50 · 88 阅读 · 0 评论 -
【LeetCode】二分查找
Java codeclass Solution { public int search(int[] nums, int target) { int length = nums.length; int front = 0; int rear = length - 1; int mid; whi...原创 2019-08-06 18:27:10 · 97 阅读 · 0 评论 -
【LeetCode】删除链表的倒数第N个节点
Java codeclass Solution { public ListNode removeNthFromEnd(ListNode head, int n) { if(n == 0) { return head; } ListNode temp = head; int length = 0; ...原创 2019-08-06 08:18:03 · 122 阅读 · 0 评论 -
【LeetCode】循环队列
class MyCircularQueue { private int front; private int rear; private int maxSize; private int size; private int[] arr; /** Initialize your data structure here. Set the siz...原创 2019-08-06 08:15:26 · 374 阅读 · 0 评论 -
【LeetCode】最小栈
Java codeclass MinStack { class Node { int val; Node next; public Node(int val) { this.val = val; } } Node headNode; /** initializ...原创 2019-08-13 09:58:25 · 121 阅读 · 0 评论