Day 11: Number of Good Pairs | LeetCode 1512 | JavaScript DSA Series

preview_player
Показать описание
Welcome to Day 11 of Code Journey with Prem!

In today’s video, we are solving LeetCode Problem 1512 – Number of Good Pairs using JavaScript.

Problem Summary:
You are given an array of numbers. Your task is to count how many pairs (i, j) exist where:

nums[i] is equal to nums[j]

and i is less than j

This is a basic but powerful problem to improve your understanding of arrays, nested loops, and how to work with comparisons and indexes.

Example:
Input: [1, 2, 3, 1, 1, 3]
Output: 4
Explanation: The good pairs are (0,3), (0,4), (3,4), and (2,5)

What you’ll learn in this video:

How to use loops to compare elements

Count matching pairs based on conditions

Step-by-step logic in a clear and beginner-friendly way

Clean code implementation in JavaScript

This problem helps you build strong logic for interviews and DSA practice.
If you're following this daily series, you're getting better one step at a time.

Don’t forget to:

Like the video

Drop your thoughts or questions in the comments

Share with your coding buddies

Subscribe for more DSA content

Keep coding and see you in Day 12!

Hashtags:
#Day11 #Leetcode1512 #JavaScript #DSAseries #CodingWithPrem #ArrayProblems #BeginnerFriendly
Рекомендации по теме
visit shbcf.ru