This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ASIN": "", | |
"productInfo": [{ | |
"productDetail": { | |
"UPC": "", | |
"bestSellerRank": ["#1 ['cate1','cate2',...]",""], | |
}, | |
"name": "", | |
"img": "", | |
"productDescription": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// Test | |
// | |
// Created by CirnoCee on 4/23/14. | |
// Copyright (c) 2014 CirnoCee. All rights reserved. | |
// | |
#include <iostream> | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public int[] plusOne(int[] digits) { | |
int length = digits.length; | |
int plus = 1; | |
for (int i = length - 1; i >= 0; i--){ | |
digits[i] += plus; | |
if (digits[i] >= 10){ | |
plus = 1; | |
digits[i] -= 10; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public int searchInsert(int[] A, int target) { | |
int i = 0; | |
if (target < A[i]) return 0; | |
if (target > A[A.length - 1]) return A.length; | |
while ((target >= A[i]) || (i + 1 <= A.length)){ | |
if (target == A[i]){ | |
return i; | |
} | |
if ((target > A[i]) && (target < A[i + 1])){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public ArrayList<ArrayList<Integer>> generate(int numRows) { | |
ArrayList<Integer> ret = new ArrayList<Integer>(); | |
ArrayList<Integer> ret_temp = new ArrayList<Integer>(); | |
ArrayList<ArrayList<Integer>> rn = new ArrayList<ArrayList<Integer>>(); | |
if (numRows == 0) return rn; | |
ret_temp.add(1); | |
rn.add(ret_temp); | |
if (numRows == 1) return rn; | |
ret.add(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public boolean searchMatrix(int[][] matrix, int target) { | |
int height = matrix.length; | |
int width = matrix[0].length; | |
int i = -1; | |
int j = -1; | |
while (i <= height - 1){ | |
if (i == height - 1) break; | |
if (target < matrix[i + 1][0]) break; | |
i++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public int singleNumber(int[] A) { | |
int ret = 0; | |
for (int i = 0; i < A.length; i++){ | |
ret = ret ^ A[i]; | |
} | |
return ret; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for binary tree | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { val = x; } | |
* } | |
*/ | |
public class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for binary tree | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { val = x; } | |
* } | |
*/ | |
public class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public int firstMissingPositive(int[] A) { | |
if (A.length == 0) return 1; | |
for (int i = 0; i < A.length; i++) { | |
if (A[i] <= A.length && A[i] > 0 && A[i] != i+1) { | |
if (A[A[i]-1] != A[i]) { | |
int tmp = A[A[i]-1]; | |
A[A[i]-1] = A[i]; | |
A[i] = tmp; | |
i--; |
OlderNewer