Number of Good Pairs leetcode solution (Problem 1512)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Vipul Bhai Love you for the way of teaching.

jameelahmed
Автор

sir actually i had done the solution in diffrent way so want to ask how much optimized my solution is can you pls tell class Solution {
public int numIdenticalPairs(int[] num) {
int count=0;

for (int i = 0; i < num.length; i++) {
for (int j = i; j < num.length; j++) {
if(i==j){
continue;
}else if(num[i]==num[j]) {
count++;
}
}
}return count;
}}

ramtewani