Problem 74: Find the First True in a Sorted Boolean Array [Stripe]
Logic, Problem Soling, Boolean, Arrays
Hey, it’s your favorite cult leader here 🐱👤
On Wednesdays, I will send you a problem for you to solve. The solutions will be sent on the following day. Use the weekly problems as a guide way to get some consistency in your life.
To get access to all my articles and support my crippling chocolate milk addiction, consider subscribing if you haven’t already!
p.s. you can learn more about the paid plan here.
I got a few things to say to you.
Zoom laid off 1.3K Employees and Disney is now planning to lay off another 7,000. To those of you who want to know why we see profitable corporations conduct mass layoffs, check out this post. We will do a more detailed Finance Friday on it soon, but that post is a good introduction.
Secondly, the Tech Made Simple Ebook is out on Amazon!!! The Ebook is just the collection of posts that we covered in January. You can find it here. I wanted to make it free, but Amazon has a minimum price of 1 USD, so that is what I set it to.
In the description, there is a link to the Free Version Ebook. The Free Version is the complete book, as a pdf. You can share that with whomever you want. Buying and reviewing the book would help me a ton, but if you can't the free version has you covered.
Now let’s get to the question
Problem
An array of boolean values is divided into two sections; the left section consists of all false
and the right section consists of all true
. Find the First True in a Sorted Boolean Array of the right section, i.e. the index of the first true
element. If there is no true
element, return -1.
Input: arr = [false, false, true, true, true]
Output: 2
That is it for this piece. I appreciate your time. As always, if you’re interested in reaching out to me or checking out my other work, links will be at the end of this email/post. If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here. And if you found value in this write-up, I would appreciate you sharing it with more people.
For those of you interested in taking your skills to the next level, keep reading. I have something that you will love.
Upgrade your tech career with a premium subscription ‘Tech Made Simple’! Stay ahead of the curve in AI, software engineering, and tech industry with expert insights, tips, and resources. 20% off for new subscribers by clicking this link. Subscribe now and simplify your tech journey!
Reach out to me
Use the links below to check out my other content, learn more about tutoring, reach out to me about projects, or just to say hi.
If you like my writing, I would really appreciate an anonymous testimonial. You can drop it here.
To help me understand you fill out this survey (anonymous)
Check out my other articles on Medium. : https://rb.gy/zn1aiu
My YouTube: https://rb.gy/88iwdd
Reach out to me on LinkedIn. Let’s connect: https://rb.gy/m5ok2y
My Instagram: https://rb.gy/gmvuy9
My Twitter: https://twitter.com/Machine01776819