Alternating Characters HackerRank problem solution

Alternating Characters Problem: You are given a string containing characters  and  only. Your task is to change it into a string such that there are no matching adjacent characters. To do this, you are allowed to delete zero or more characters in the string. Your task is to find the minimum number of required deletions. Example Remove …

Alternating Characters HackerRank problem solution Read More »

Plus One LeetCode Problem solution

66. Plus One Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.You may assume the integer does not contain any leading zero, except the number 0 itself. …

Plus One LeetCode Problem solution Read More »

Two Sum – LeetCode Problem Solution

Two Sum Problem: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each input would have exactly one solution, and you may not use the same element twice.You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: …

Two Sum – LeetCode Problem Solution Read More »

Shopping Cart