first commit 3.8

This commit is contained in:
zhangsan 2025-03-08 10:36:36 +08:00
parent 5f25a34e75
commit 4d6b623f9a
2 changed files with 0 additions and 31 deletions

View File

@ -1,15 +0,0 @@
package edu.whut.hash;
/**
* 题目两数之和 (Two Sum)
* 描述给定一个整数数组 nums 和一个目标值 target请你在该数组中找出和为目标值的那两个整数并返回它们的数组下标
* 链接https://leetcode.cn/problems/two-sum/
*/
public class TwoSum {
public int[] twoSum(int[] nums, int target) {
// 实现代码
return new int[]{0, 1};
}
}

View File

@ -1,16 +0,0 @@
package edu.whut.hash;
import org.junit.Test;
public class HashAlgorithmsTest {
@Test
public void testTwoSum() {
TwoSum solution = new TwoSum();
int[] nums = {2, 7, 11, 15};
int target = 9;
int[] result = solution.twoSum(nums, target);
for (int i = 0; i < result.length; i++) {
System.out.println(result[i]);
}
}
}