Zoka
LeetCode 2235. Add Two Integers
class Solution { public int sum(int num1, int num2) { return num1+num2; } }
LeetCode 1672. Richest Customer Wealth (Java)
class Solution { public int maximumWealth(int[][] accounts) { int max=0; for(int[] i1: accounts){ int wealth...
LeetCode 1342. Number of Steps to Reduce a Number to Zero (Java)
class Solution { public int numberOfSteps(int num) { int i=0; int n=num; do{ if(n%2 == 0){ ...
LeetCode 876. Middle of the Linked List (Java)
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNo...
LeetCode 724. Find Pivot Index (Java)
class Solution { public int pivotIndex(int[] nums) { int sum, leftsum; sum = 0; leftsum = 0; for(int ...
LeetCode 412. Fizz Buzz
class Solution { public List String fizzBuzz(int n) { ArrayList String al = new ArrayList (n); al.c...
LeetCode 412. Fizz Buzz
class Solution { public List String fizzBuzz(int n) { ArrayList String al = new ArrayList (n); al.c...
LeetCode 205. Isomorphic Strings
class Solution { public boolean isIsomorphic(String s, String t) { if(s.length()!=t.length()){ return ...
LeetCode 9. Palindrome Number
class Solution { public boolean isPalindrome(int x) { if(x 0 (x % 10 == 0 x != 0)) { return false; ...
LeetCode 1. Two Sum (Java)
class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2]; for(int i = 0; i nums.len...
LeetCode 1480. Running Sum of 1d Array (Java)
class Solution { public int[] runningSum(int[] nums) { for(int i=1; i nums.length; i++){ nums[i]=nums[i]+nums[i-1]; } ...
紀錄
第一篇發文。