From 9151cb91b013efe67c537df00ba3c1149761eca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C5=9F=C4=B1nsu=20Ar=C4=B1c=C4=B1?= Date: Sun, 30 Jan 2022 23:10:52 +0300 Subject: [PATCH] 1512 --- E_1512_NumberOfGoodPairs.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 E_1512_NumberOfGoodPairs.java diff --git a/E_1512_NumberOfGoodPairs.java b/E_1512_NumberOfGoodPairs.java new file mode 100644 index 0000000..51a9098 --- /dev/null +++ b/E_1512_NumberOfGoodPairs.java @@ -0,0 +1,12 @@ +public class Solution { + public int numIdenticalPairs(int[] nums) { + int sonuc = 0; + for (int i = 0; i < nums.length; i++) { + for (int j = 0; j < nums.length; j++) { + if (nums[i] == nums[j] && i < j){ + sonuc++; + } + } + } return sonuc; + } +} \ No newline at end of file