
leetcode
「已注销」
这个作者很懒,什么都没留下…
展开
-
Two sum
题目:给定一个整数数组和一个目标值,找出数组中和为目标值的两个数。你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用。 public static int[] twoSum(int[] nums, int target) { int []a=new int[2]; for(int i = 0; i < nums.length - 1; i++) { for...原创 2018-05-30 19:40:01 · 112 阅读 · 0 评论 -
add Two Numbers
给定两个非空链表来表示两个非负整数。位数按照逆序方式存储,它们的每个节点只存储单个数字。将两数相加返回一个新的链表。你可以假设除了数字 0 之外,这两个数字都不会以零开头。public class ListNode { ListNode next; int val; public ListNode(int x) { val = x; } } public ListNode add...原创 2018-05-30 20:18:09 · 157 阅读 · 0 评论 -
leetcode 206 - 反转链表
public class ReverseList { public static ListNode reverseList(ListNode head) { if (head == null || head.next == null) { return head; } ListNode pre = null; pre.next = null; ...原创 2018-05-30 23:17:39 · 134 阅读 · 0 评论 -
35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. ...原创 2019-05-17 13:14:39 · 152 阅读 · 0 评论