摘要:
c++最终版 class Solution {public: int firstMissingPositive(vector<int>& nums) { int n = nums.size(); for (int i = 0; i < n; i++) while (nums[i] > 0 && nu 阅读全文
摘要:
public class Solution { public int[] twoSum(int[] numbers, int target) { Map<Integer, Integer> map = new HashMap<Integer, Integer>(); int[] results = 阅读全文
摘要:
暴力解法O(n2) 略 —————————————————————————————— java中map的get时间为O(1) C++中为O(logn) 哈希解法第一版 O(n) public class Solution {public int[] twoSum(int[] nums, int ta 阅读全文
摘要:
我的做法 time : O(N2) public class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2]; int i = 0, j = 0; for (; i < nums.l 阅读全文
摘要:
17.4.25 WRONG ANSWERS public class Solution { public int nthSuperUglyNumber(int n, int[] primes) { int len = primes.length; int[] pw = new int[len];// 阅读全文
摘要:
不去重错误版 17.4.23 long isMin (long a, long b) { if (a >= b) a = b; return a;}long nthUglyNumber(long n) { long *l = (long*)malloc(n*sizeof(long)); for (l 阅读全文