题目
代码
pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
let len = nums.len();
let mut a:Vec<i32> = vec![0;len];
for i in 0..len {
for j in 0 .. i {
if a[j] == nums[i] {
let result = vec![j as i32,i as i32];
return result;
}
}
a[i] = target - nums[i];
}
[0,0].to_vec()
}