Photo by Carlos Irineu da Costa on Unsplash

The Problem Statement:


Sample I/O:

String="aabccbb", k=2
5
Replace the two 'c' with 'b' to have a longest repeating substring "bbbbb".
Input: String="abbcb", k=1
Output: 4
Explanation: Replace the 'c' with…



Sample I/O

The Pattern:


[1, 7, 3, 4]
[84, 12, 28…

The Problem and example I/O:

[2,1,5]
[1,7,5,1,9,2,5,1]


The Premise

  • A guy goes along corridor N times which have N bulbs
  • Every time he goes along the corridor he toggles the switch of certain bulbs based on certain condition
  • We have to determine the state of the last bulb i.e. Nth bulb.

The Conditions

  • The bulbs have serial numbers starting from 1 to N i.e. …


The Constraints

  • 1 ≤ N ≤ 10⁵


Photo by Yeshi Kangrang on Unsplash

Abrar Shariar

Techie | Engineer | Coder

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store