[Solved] Doremy’s Drying Plan (Hard Version) Solution

Doremy’s Drying Plan (Hard Version) Solution The only differences between the two versions of this problem are the constraint on k , the time limit and the memory limit. You can make hacks only if all versions of the problem are solved. Doremy resides in a country with �n cities, numbered from 1 to �n. … Read more

[Solution] Doremy’s Paint 3 Solution Codeforces

[Solution] Doremy’s Paint 3 Solution Codeforces time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output An array b1,b2,…,bn�1,�2,…,�� of positive integers is good if all the sums of two adjacent elements are equal to the same value. More formally, the array is good if there exists a k� such that b1+b2=b2+b3=…=bn−1+bn=k�1+�2=�2+�3=…=��−1+��=�. … Read more

Minimum Number of Changes to Make Binary String Beautiful Solution Leetcode

Minimum Number of Changes to Make Binary String Beautiful Solution Leetcode User Accepted:0 User Tried:0 Total Accepted:0 Total Submissions:0 Difficulty:Medium You are given a 0-indexed binary string s having an even length. A string is beautiful if it’s possible to partition it into one or more substrings such that: Each substring has an even length. Each substring contains only 1‘s or only 0‘s. You can change … Read more

[Solution] Length of the Longest Subsequence That Sums to Target Solution Leetcode

Length of the Longest Subsequence That Sums to Target Solution Leetcode User Accepted:0 User Tried:0 Total Accepted:0 Total Submissions:0 Difficulty:Medium You are given a 0-indexed array of integers nums, and an integer target. Return the length of the longest subsequence of nums that sums up to target. If no such subsequence exists, return -1. A subsequence is an array that can be derived from another array by deleting some … Read more

[Solved] Minimum Changes to Make K Semi-palindromes solution leetcode

6920. Minimum Changes to Make K Semi-palindromes User Accepted:1 User Tried:13 Total Accepted:1 Total Submissions:18 Difficulty:Hard Given a string s and an integer k, partition s into k substrings such that the sum of the number of letter changes required to turn each substring into a semi-palindrome is minimized. Return an integer denoting the minimum number of letter changes required. Notes A string is a palindrome if it can be read the … Read more

[Solved] Minimum Number of Groups to Create a Valid Assignment Solution Leetcode

100097. Minimum Number of Groups to Create a Valid Assignment User Accepted:4 User Tried:107 Total Accepted:4 Total Submissions:131 Difficulty:Medium You are given a 0-indexed integer array nums of length n. We want to group the indices so for each index i in the range [0, n – 1], it is assigned to exactly one group. A group assignment is valid if the following conditions hold: For every group g, … Read more

[Solved] Minimum Sum of Mountain Triplets II solution leetcode

100114. Minimum Sum of Mountain Triplets II User Accepted:1767 User Tried:2041 Total Accepted:1774 Total Submissions:2267 Difficulty:Medium You are given a 0-indexed array nums of integers. A triplet of indices (i, j, k) is a mountain if: i < j < k nums[i] < nums[j] and nums[k] < nums[j] Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.   Example 1: Input: nums … Read more

[Solved] Minimum Sum of Mountain Triplets I solution leetcode

100106. Minimum Sum of Mountain Triplets I User Accepted:5299 User Tried:5952 Total Accepted:5368 Total Submissions:7251 Difficulty:Easy You are given a 0-indexed array nums of integers. A triplet of indices (i, j, k) is a mountain if: i < j < k nums[i] < nums[j] and nums[k] < nums[j] Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.   Example 1: Input: nums … Read more

[solution] Alice and Bob are playing a game. They have two positive integers �X and �Y Solution Codechef

Problem SOLUTION CODECHEF Alice and Bob are playing a game. They have two positive integers �X and �Y Solution Codechef In one operation: First Alice would replace exactly one of the numbers with the gcd of current numbers. In words, she would select either �X or �Y and replace it with gcd⁡(�,�)gcd(X,Y). Then Bob would replace exactly one of the numbers with the lcm of current numbers. Find the minimum sum of numbers … Read more

[SOLUTION]Chef has a circular pizza and a knife to cut that into pieces. He can only cut the pizza in a way such that the knife starts from the boundary of the pizza, passes the centre, and ends at the boundary Solution Codechef

Problem Chef has a circular pizza and a knife to cut that into pieces. He can only cut the pizza in a way such that the knife starts from the boundary of the pizza, passes the centre, and ends at the boundary. Solution Codechef Chef has a circular pizza and a knife to cut that … Read more