Last active
May 2, 2020 00:05
-
-
Save pmatatias/39b05620d3fc2775712e22f401d30c35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*pota-too*/ | |
| class Solution { | |
| public int singleNumber(int[] nums) { | |
| int hitung= 0; | |
| int hasil=0; | |
| for (int i=0; i<nums.length; i++){ | |
| hitung=0; // reset nilai hitung menjadi 0 setiap i yang baru. | |
| for (int j=0;j<nums.length; j++){ | |
| if(nums[i] == nums[j]){ | |
| hitung+=1; | |
| } | |
| } | |
| if (hitung <2) hasil = nums[i]; | |
| } | |
| return hasil; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment