분류 전체보기
-
1790. Check if One String Swap Can Make Strings Equal javaLeetCode_Study_Plan/Programming Skills 2022. 9. 20. 16:09
https://leetcode.com/problems/check-if-one-string-swap-can-make-strings-equal/?envType=study-plan&id=programming-skills-i Check if One String Swap Can Make Strings Equal - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public boolean areAlmostEqual(String s1, Stri..
-
202. Happy Number javaLeetCode_Study_Plan/Programming Skills 2022. 9. 20. 11:50
https://leetcode.com/problems/happy-number/?envType=study-plan&id=programming-skills-i class Solution { public boolean isHappy(int n) { int sum = 0; ArrayList arraylist = new ArrayList(); while (true) { System.out.println("start n:" + n); while (n != 0) { int tmp = n % 10; n = n / 10 ; sum += Math.pow(tmp, 2); } System.out.println("calculated sum:" + sum); if (sum == 1) { return true; } else { i..
-
1502. Can Make Arithmetic Progression From Sequence javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 22:24
https://leetcode.com/problems/can-make-arithmetic-progression-from-sequence/?envType=study-plan&id=programming-skills-i Can Make Arithmetic Progression From Sequence - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public boolean canMakeArithmeticProgression(int[]..
-
1822. Sign of the Product of an Array javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 22:10
https://leetcode.com/problems/sign-of-the-product-of-an-array/?envType=study-plan&id=programming-skills-i Sign of the Product of an Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public int arraySign(int[] nums) { int cnt = 0; for (int i = 0 ; i < nums.len..
-
1779. Find Nearest Point That Has the Same X or Y Coordinate javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 22:04
https://leetcode.com/problems/find-nearest-point-that-has-the-same-x-or-y-coordinate/?envType=study-plan&id=programming-skills-i Find Nearest Point That Has the Same X or Y Coordinate - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public int nearestValidPoint(in..
-
976. Largest Perimeter Triangle javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 21:39
https://leetcode.com/problems/largest-perimeter-triangle class Solution { public int largestPerimeter(int[] nums) { Arrays.sort(nums); for (int i = nums.length-1; i>=2 ; i--) { if (nums[i] < nums[i-1] + nums[i-2]){ return nums[i] + nums[i-1] + nums[i-2]; } } return 0; } }
-
1281. Subtract the Product and Sum of Digits of an Integer javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 21:05
https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/ Subtract the Product and Sum of Digits of an Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com class Solution { public int subtractProductAndSum(int n) { int producted = 1; int added = 0 ; i..
-
191. Number of 1 Bits javaLeetCode_Study_Plan/Programming Skills 2022. 9. 19. 20:48
https://leetcode.com/problems/number-of-1-bits/ Number of 1 Bits - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com public class Solution { // you need to treat n as an unsigned value public int hammingWeight(int n) { int cnt = 0; while(n != 0) { cnt = cnt + (n & 1); n = n>>>1; } re..