摘要:
有一个数组,找出数组中出现次数最多的两个数字 public static void main(String[] args) { int[] nums = {1, 3, 2, 1, 3, 2, 4, 3, 4, 4}; // 示例数组 Map<Integer, Integer> countMap = 阅读全文
posted @ 2024-06-27 23:16
tianshu
阅读(59)
评论(0)
推荐(0)
摘要:
给定一个数组和一个数字,找出数组中的两个值加起来等于这个数字 import java.util.HashMap; import java.util.Map; public class TwoSum { // 方法:寻找数组中两个数相加等于目标值的索引 public static int[] twoS 阅读全文
posted @ 2024-06-27 22:29
tianshu
阅读(87)
评论(0)
推荐(0)

浙公网安备 33010602011771号