Questions related to strings

## 1’s and 2’s complement of a Binary Number

Given a Binary Number as a string, print its 1’s and 2’s complements. 1’s complement of a binary number is another binary number obtained by… Read More »

## Form minimum number from given sequence

Given a pattern containing only I’s and D’s. I for increasing and D for decreasing. Devise an algorithm to print the minimum number following that… Read More »

## Amazon Interview Experience | Set 241 (1.5 years experience)

Round-1 (World Trade Centre, Bangalore) – Technical 1. Given an array that is first increasing then decreasing, find an element in it. Example: arr[] =… Read More »

## Print Concatenation of Zig-Zag String in ‘n’ Rows

Given a string and number of rows ‘n’. Print the string formed by concatenating n rows when input string is written in row-wise Zig-Zag fashion.… Read More »

## Check if edit distance between two strings is one

An edit between two strings is one of the following changes. Add a character Delete a character Change a character Given two string s1 and… Read More »

## Find the most frequent digit without using array/string

Given an integer, find the most occurring digit in it. If two or more digits occur same number of times, then return the highest of… Read More »

## Remove recurring digits in a given number

Given a number as string, remove recurring digits from the given string. The changes must be made in-place. Expected time complexity O(n) and auxiliary space… Read More »

## Find the maximum subarray XOR in a given array

Given an array of integers. find the maximum XOR subarray value in given array. Expected time complexity O(n). Examples: Input: arr[] = {1, 2, 3,… Read More »

## Minimum number of bracket reversals needed to make an expression balanced

Given an expression with only ‘}’ and ‘{‘. The expression may not be balanced. Find minimum number of bracket reversals to make the expression balanced.… Read More »

## Reverse a string without affecting special characters

Given a string, that contains special character together with alphabets (‘a’ to ‘z’ and ‘A’ to ‘Z’), reverse the string in a way that special… Read More »

## Paytm Interview Experience | Set 6 (Recruitment Drive)

I would like to share recent recruitment drive I attended from Paytm CS + Programming + Coding – Screening round 20 MCQ realted to C,… Read More »

## Accolite Interview Experience | Set 9 (On-Campus)

Accolite Software visited our campus on 31st august 2015. At first, they conducted pre-placement-talk that was the most interesting session i ever attended. Followed by… Read More »

## Recursive Implementation of atoi()

The atoi() function takes a string (which represents an integer) as an argument and returns its value. We have discussed iterative implementation of atoi(). How… Read More »

## Program to add two binary strings

Given two binary strings, return their sum (also a binary string). Example: Input: a = “11”, b = “1” Output: “100” We strongly recommend you… Read More »

## Length of the longest valid substring

Given a string consisting of opening and closing parenthesis, find length of the longest valid parenthesis substring. Examples: Input : ((() Output : 2 Explanation… Read More »