is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
both operations can be done in O(1) time if you use malloc memory object of size = number of bulbs in bits. (lets call it bulbState)
- anup August 14, 2016define
isOnOff(i)
{
same size memory object set value to 1 (call it indexSet)
indexSet << i;(now indexSet has ith bit set)
indexSet = indexSet & bulbState;
return indexSet
}
toggle(leftIndex,rightIndex).
{
make a copy of malloc object , << leftIndex, >> (leftIndex +(numberOfBulb - rightIndex) -> This will give an object all zero except the range is copy of original array.(lets call it rangeState)
rangeflipedState = ~rangeState (range fliped state is all ones except range is fliped)
similarly we create one more same size malloc object will all ones but range is set to zero(lets call it mask)
bulbState = bulbState & mask. (all bulb state is original state but range bulbs are all off)
bulbState = bulbState | rangeflipedSate;
}
I am assuing bit wise operation constant time. Please correct me if find anything.