Leetcode (Java)
Java
KAKUNIN_
伤痛之末,涅槃之始
展开
-
9. 回文数
转化为字符串处理 class Solution { public boolean isPalindrome(int x) { String num = Integer.toString(x); int len = num.length(); for (int i = 0; i < len/2; i++) { if (num.charAt(i) != num.charAt(len-i-1)) .原创 2022-05-06 10:54:53 · 228 阅读 · 0 评论 -
1.两数之和
暴力求解 class Solution { public int[] twoSum(int[] nums, int target) { for (int i = 0; i < nums.length-1; i++) { for (int j = i+1; j < nums.length; j++) { if (nums[i] + nums[j] == target) { re.原创 2022-05-05 16:59:32 · 190 阅读 · 0 评论