Internally, the elements in the unordered_map are not sorted in any particular order with respect to either their key or values (unlike map)
Given a string s, consisting of English letters, symbols and spaces, find the length of the longest substring without repeating characters.
Problem Two words are anagrams of one another if their letters can be rearranged to form the other word. Given a string, split it into two contiguous substrings of equal length. Determine the minimum number of characters to change to make the two substrings into anagrams of one another. Example s […]
Problem Given an array A of length N, your task is to find the element which repeats in A maximum number of times as well as the corresponding count. In case of ties, choose the smaller element first. Codechef Problem Link Input First line of input contains an integer T, denoting […]
In the previous post, we discussed about finding the total number of continuous subarrays of a given array (of non-negative numbers) whose sum equals to k. In this post we’ll include negative numbers in the given array arr. Problem Statement https://leetcode.com/problems/subarray-sum-equals-k/ Example 1: Input: arr = [-1,-1,1], k = 0 Output: 1 Explanation: […]