Microsoft OA Lexicographically Smallest String

Microsoft Online Assessment 2021 Questions and Solution

Microsoft Online Assessment Lexicographically Smallest String Lexicographically smallest string formed by removing at most one character. Also See: Microsoft Online Assessment Questions and Solution Example 1: Input: abczd Output: abcd Solution Program C++: By definition of lexicographical order each next string is largerthan the previous one А < АА < ААА < АAB < ААC < АB … Read more

Min Swaps to Make Palindrome Solution

Microsoft Online Assessment 2021 Questions and Solution

This question can be called as “Minimum Adjacent Swaps to Make Palindrome” or “Min Swaps to Make Palindrome” either way both are same. Make sure you look through the code before copying it. Microsoft Online Assessment Min Swaps to Make Palindrome A palindrome is a string of letters that is equal to itself when reversed. … Read more

Microsoft OA Day of week that is K days later Solution

Microsoft Online Assessment 2021 Questions and Solution

Microsoft Online Assessment Day of week that is K days later Leetcode Given a day of the week, with an integer K representing numbers, find the day of the week after K days. Also See: Microsoft Online Assessment Questions and Solution Example 1: Input: day = “Monday” K = 3 Output: Thursday Solution Program C++: Day of week that is K days later … Read more

Min Deletions To Obtain String in Right Format

Microsoft Online Assessment 2021 Questions and Solution

Microsoft Online Assessment Min Deletions To Obtain String in Right Format You are given a string s consisting only of characters ‘a’ and ‘b’​​​​. You can delete any number of characters in s to make s balanced. s is balanced if there is no pair of indices (i,j) such that i < j and s[i] = ‘b’ and s[j]= ‘a’. Return the minimum number of deletions needed to make s balanced. Also See: Microsoft Online Assessment Questions and Solution Example … Read more

Maximal Network Rank Solution

Microsoft Online Assessment 2021 Questions and Solution

Microsoft Online Assessment Maximal Network Rank Solution There is an infrastructure of n cities with some number of roads connecting these cities. Each roads[i] = [ai, bi] indicates that there is a bidirectional road between cities ai and bi. The network rank of two different cities is defined as the total number of directly connected roads to either city. If a road is directly connected to both cities, it is only counted once. … Read more