C++

Learn and practice the data structure and algorithm with C++ Programming language

Leetcode 342. Power of Four (Easy)

Leetcode 342. Power of Four

LeetCode 342. Power of Four :Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Power of Four” or “LeetCode 342. Method we are using are Mathematical approach and Bit Manipulation. Approach : Mathematical Line Explanation n x fmod(x, 1.0) Output 1 Check if n <= 0. 16 – […]

Leetcode 342. Power of Four (Easy) Read More »

LeetCode 1793. Maximum Score of a Good Subarray (Hard)

LeetCode 1793. Maximum Score of a Good Subarray

LeetCode 1793. Maximum Score of a Good Subarray :Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Maximum Score of a Good Subarray” or “LeetCode 1793. ‘ Appraoch : Two Pointer dry run of the given code with the example ‘A = [1,4,3,7,4,5]’ and ‘k =

LeetCode 1793. Maximum Score of a Good Subarray (Hard) Read More »

LeetCode1425. Constrained Subsequence Sum (Medium) – DP + Heap Appraoch

1425. Constrained Subsequence Sum

LeetCode 1425. Constrained Subsequence Sum :Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Constrained Subsequence Sum” or “LeetCode 1425. ‘ Approach: Dynamic Programming with a Heap table representing the step-by-step calculation of the example with the input array nums = [10, 2, -10, 5, 20]

LeetCode1425. Constrained Subsequence Sum (Medium) – DP + Heap Appraoch Read More »

LeetCode 1420: Build Array Where You Can Find The Maximum Exactly K Comparisons

LeetCode 1420 Build Array Where You Can Find The Maximum Exactly K Comparisons

LeetCode 1420. Build Array Where You Can Find The Maximum Exactly K Comparisons :Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Build Array Where You Can Find The Maximum Exactly K Comparisons” or “LeetCode 1420 ‘  Understanding the Challenge Before we delve into the

LeetCode 1420: Build Array Where You Can Find The Maximum Exactly K Comparisons Read More »

LeetCode 229. Majority Element II (Medium)

229. Majority Element II

Leetcode 229. Majority Element II:Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Majority Element II” or “LeetCode 229. ‘  Method : HashMap Approach – Majority Element II 1: Initialize Data Structures 2: Count Element Occurrences 3: Calculate the Threshold 4: Iterate Over Counts 5:

LeetCode 229. Majority Element II (Medium) Read More »

Leetcode 706. Design HashMap (Easy)

Leetcode 706. Design HashMap (Easy)

Leetcode 706. Design HashMap:Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Design HashMap” or “LeetCode 706. ‘  Codes : Leet code 706. C++:Leetcode 706. Java: Leetcode 706. Python: Leet code 706. Leetcode 1359 Count All Valid Pickup and Delivery Options (HARD) JavaScript: Leet code

Leetcode 706. Design HashMap (Easy) Read More »

Leetcode 2038. Remove Colored Pieces if Both Neighbors are the Same Color

Leetcode 2038. Remove Colored Pieces if Both Neighbors are the Same Color

Leetcode 2038. Remove Colored Pieces if Both Neighbors are the Same Color:Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “Remove Colored Pieces if Both Neighbors are the Same Color ” or “LeetCode .2038‘ Greedy Appraoch : Leetcode 2038. Remove Colored Pieces if Both Neighbors

Leetcode 2038. Remove Colored Pieces if Both Neighbors are the Same Color Read More »

LeetCode 132. Pattern (Medium)

LeetCode 132. Pattern (Medium)

LeetCode 132. Pattern: Hey there, coding enthusiasts! Welcome back to another exciting coding session. Today’s problem is a treat—literally! We’re going to solve the “pattern” or “LeetCode .132” Stack Approach: Leet Code 132. Pattern (Medium) Leetcode 316. Remove Duplicate Letters (Medium) C++: Stack Leet Code 132 LeetCode 896. Monotonic Array (Easy) Java: Stack Leet Code 132

LeetCode 132. Pattern (Medium) Read More »