c++

[Solved] Pairing the brackets Contest Problem

[Solved] Pairing the brackets Contest Problem

We are given bracket sequence(may not be balanced). Every character of the sequence is either ‘(‘ or ‘)’.  For each closing bracket, we need to find an opening bracket which is farthest from it (and on left of it) and pair those two brackets.Once…

[Solved] Maximum Segment Sum After Removals LeetCode Contest

[Solved] Maximum Segment Sum After Removals LeetCode Contest

You are given two 0-indexed integer arrays nums and removeQueries, both of length n. For the ith query, the element in nums at the index removeQueries[i] is removed, splitting nums into different segments. A segment is a contiguous sequence of positive integers in nums. A segment sum is the sum of every element in a segment. Return an integer array answer, of length n,…

[Solved] Shifting Letters II LeetCode Contest

[Solved] Shifting Letters II LeetCode Contest

You are given a string s of lowercase English letters and a 2D integer array shifts where shifts[i] = [starti, endi, directioni]. For every i, shift the characters in s from the index starti to the index endi (inclusive) forward if directioni = 1, or shift the characters backward if directioni = 0. Shifting a character forward means replacing it…