leetcode java
屿-Z
这个作者很懒,什么都没留下…
展开
-
Leetcode 989:数组形式的整数加法
对于非负整数 X 而言,X 的数组形式是每位数字按从左到右的顺序形成的数组。例如,如果 X = 1231,那么其数组形式为 [1,2,3,1]。给定非负整数 X 的数组形式 A,返回整数 X+K 的数组形式。示例 1:输入:A = [1,2,0,0], K = 34输出:[1,2,3,4]解释:1200 + 34 = 1234123解释 2:输入:A = [2,7,4], K = ...原创 2019-02-28 11:02:29 · 385 阅读 · 0 评论 -
565.Array Nesting Java
题目:A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } subjected to the rule below.S...原创 2019-03-02 10:17:21 · 136 阅读 · 0 评论 -
561. Array Partition I(Java)
给定一个2n整数数组,您的任务是将这些整数分组为n对整数,例如(a1,b1),(a2,b2),…,(an,bn),它使所有i的min(ai,bi)之和尽可能大,从1到n。 例1: 输入:[1,4,3,2] 产量:4 说明:n为2,对的最大和为4=min(1,2)+min(3,4)。 ...原创 2019-03-02 10:35:08 · 162 阅读 · 0 评论 -
33. Search in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found ...原创 2019-03-05 21:50:19 · 136 阅读 · 0 评论 -
34. Find First and Last Position of Element in Sorted Array
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the...原创 2019-03-05 22:52:02 · 120 阅读 · 0 评论