Skip to content

Instantly share code, notes, and snippets.

@pmatatias
Last active May 2, 2020 00:05
Show Gist options
  • Select an option

  • Save pmatatias/39b05620d3fc2775712e22f401d30c35 to your computer and use it in GitHub Desktop.

Select an option

Save pmatatias/39b05620d3fc2775712e22f401d30c35 to your computer and use it in GitHub Desktop.
/*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