Leetcode

Erect the Fence Leetcode Solution

Problem  You are given an array  trees  where  trees[i] = [x i , y i ]  represents the location of a tree in the garden. You are asked to fence the entire garden using the minimum length of rope as it is expensive. The garden is …

Remove All Adjacent Duplicates In String Leetcode Solution

Problem You are given a string   s   consisting of lowercase English letters. A   duplicate removal   consists of choosing two   adjacent   and   equal   letters and removing them. We repeatedly make  duplicate removals  on  s  u…

Maximum 69 Number LeetCode Solution in C++

Problem :  You are given a positive integer   num   consisting only of digits   6   and   9 . Return  the maximum number you can get by changing  at most  one digit ( 6  becomes  9 , and  9  becomes  6 ) . Example 1: Input: num …

Apply Operations to an Array Leetcode Solution in C++

Problem You are given a   0-indexed   array   nums   of size   n   consisting of   non-negative   integers. You need to apply   n - 1   operations to this array where, in the   i th   operation ( 0-indexed ), you will apply the…

Decode Ways LeetCode Solution in C++

Problem Description  A message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an…

That is All