But I stumbled on this question what if we interchange the negative numbers and put them together ,consecutively .
The algorithm failed . Here is the funny part when two or more negatives appear together in a row the iterator skips over one of them and splice removes an element and shifts all remaining elements to the left causing the loop to skip the next element when it executes increment which could also be a negative .
The solution is counterintuitive but simple , just using the loops backwards instead of increment if we use decrement this works perfectly fine
The key takewways as I understand from this error is one testing in different scenarios with trick inputs before calling it done will help , second sometimes reversing the loop is easier than using a complicated logic .
@JrThoughtLab
The algorithm failed . Here is the funny part when two or more negatives appear together in a row the iterator skips over one of them and splice removes an element and shifts all remaining elements to the left causing the loop to skip the next element when it executes increment which could also be a negative .
The solution is counterintuitive but simple , just using the loops backwards instead of increment if we use decrement this works perfectly fine
function countPositive(arr){
for(let i = arr.length - 1; i >= 0; i--){
if(arr[i] < 0){
arr.splice(i, 1);
}
}
return arr;
}
The key takewways as I understand from this error is one testing in different scenarios with trick inputs before calling it done will help , second sometimes reversing the loop is easier than using a complicated logic .
@JrThoughtLab
🔥2
“The best people possess a feeling for beauty, the courage to take risks, the discipline to tell the truth, the capacity for sacrifice. Ironically, their virtues make them vulnerable; they are often wounded, sometimes destroyed.”
— Ernest Hemingway
— Ernest Hemingway
Aaron Paul’s performance in Felina honestly doesn’t get the credit it deserves. In just a few moments, you can feel everything Jesse is carrying years of anger, fear, regret, and deep humiliation. No dramatic speeches. No over-the-top acting. Just a broken man finally facing it all.
That look on his face? It says more than a thousand words.
@JrThoughtLab
That look on his face? It says more than a thousand words.
@JrThoughtLab
Jimmy’s speech to Kristy Esposito.
Quoted from arguably one of the greatest show of all time . Better call Saul [ Breaking Bad prequel]
S4E10 ❤️
#Movie_quotes #lessons
@JrThoughtLab
Quoted from arguably one of the greatest show of all time . Better call Saul [ Breaking Bad prequel]
“You didn’t get it [the scholarship]. You were never gonna get it. They dangle these things in front of you. They tell you you got a chance, but I’m sorry, it’s a lie, because they had already made up their mind and they knew what they were gonna do before you walked in the door. You made a mistake [shoplifting], and they are never forgetting it. As far as they’re concerned, your mistake is just… It’s who you are, and it’s all you are. And I’m not just talking about the scholarship here. I’m talking about *everything*. I mean, they’ll smile at you, they’ll pat you on the head, but they are *never, ever* letting you in. But listen. Listen. It doesn’t matter. It doesn’t because you don’t need them. They’re not gonna give it to you? So what? You’re gonna take it. You’re gonna do whatever it takes. Do you hear me? You are not gonna play by the rules. You’re gonna go your own way. You’re gonna do what they won’t do. You’re gonna be smart. You are gonna cut corners, and you are gonna win. They’re on the 35th floor? You’re gonna be on the 50th floor. You’re gonna be looking down on them. And the higher you rise, the more they’re gonna hate you. Good. Good. You rub their noses in it. You make them suffer. You don’t matter all that much to them. So what? So what? Screw them. Remember, the winner takes it all.
S4E10 ❤️
#Movie_quotes #lessons
@JrThoughtLab
❤1
Jr's ThoughtLab✨
Jimmy’s speech to Kristy Esposito. Quoted from arguably one of the greatest show of all time . Better call Saul [ Breaking Bad prequel] “You didn’t get it [the scholarship]. You were never gonna get it. They dangle these things in front of you. They tell…
We can understand that here Jimmy’s speech is more than just personal advice it’s a critique of society itself.
Institutions rarely forgive mistakes-Once someone has a blemish on their record , society often defines them by it permanently. Redemption is promised but rarely granted.
Gatekeeping by the elite- Those in power ( committees, corporations, law firms) often pretend to be fair and inclusive, but decisions are made behind closed doors.
Merit is overshadowed by bias, reputation, and conformity.
The illusion of opportunity- Society dangles opportunities ,scholarships, promotions, acceptance yet many are symbolic, designed to maintain hope while reinforcing exclusion.
Playing “by the rules” often benefits those already accepted into the system. Outsiders are pressured to either conform endlessly or break the rules to survive.
Rising above the system doesn’t earn admiration it provokes hostility. Society resents those who succeed without playing by its rules.
@JrThoughtLab
Institutions rarely forgive mistakes-Once someone has a blemish on their record , society often defines them by it permanently. Redemption is promised but rarely granted.
Gatekeeping by the elite- Those in power ( committees, corporations, law firms) often pretend to be fair and inclusive, but decisions are made behind closed doors.
Merit is overshadowed by bias, reputation, and conformity.
The illusion of opportunity- Society dangles opportunities ,scholarships, promotions, acceptance yet many are symbolic, designed to maintain hope while reinforcing exclusion.
Playing “by the rules” often benefits those already accepted into the system. Outsiders are pressured to either conform endlessly or break the rules to survive.
Rising above the system doesn’t earn admiration it provokes hostility. Society resents those who succeed without playing by its rules.
@JrThoughtLab
❤2
Forwarded from Dagmawi Babi
Netflix won the bidding war to acquire Warner Bros Discovery and I'm going to go kms now.
Dagmawi Babi
Netflix won the bidding war to acquire Warner Bros Discovery and I'm going to go kms now.
My long life plan to binge movies are gonna be ruined by The LGBT centered cooperate [Netflix] ):
Can't believe every good movies i know are written by these few individuals
Only Nolan is missing
@JrThoughtLab
Only Nolan is missing
@JrThoughtLab
Coldplay’s A Film For The Future is a 44‑minute immersive visual companion to their album Moon Music, designed to blend sound and art into a unique sensory journey. It’s not just a concert film .it’s a collaborative artwork created by over 150 visual artists worldwide, each interpreting Coldplay’s music through their own lens.
[Coldplay - A Film For The Future (Full Film)]
[Coldplay - A Film For The Future (Full Film)]
YouTube
Coldplay - A Film For The Future (Full Film)
Coldplay - A Film for the Future
A Film For The Future is the 44-minute visual companion to their worldwide No. 1 album, Moon Music. Listen now: https://Coldplay.lnk.to/MoonMusic.
Attend special 360-degree screenings of the film at Lightroom in London.…
A Film For The Future is the 44-minute visual companion to their worldwide No. 1 album, Moon Music. Listen now: https://Coldplay.lnk.to/MoonMusic.
Attend special 360-degree screenings of the film at Lightroom in London.…
Jr's ThoughtLab✨
Coldplay’s A Film For The Future is a 44‑minute immersive visual companion to their album Moon Music, designed to blend sound and art into a unique sensory journey. It’s not just a concert film .it’s a collaborative artwork created by over 150 visual artists…
Saw this morning and i am in obsession
By the way, I’m officially an F1 fan! 🏎 I only started following very recent, but this season has been nothing short of a battlefield. The championship battle between the Papayas (McLaren) and the unstoppable Red Bull is pure war on wheels.
Will McLaren rise to the occasion and snatch the glory, or will the GOAT, Verstappen, assert his dominance once again? Honestly, a comeback for Verstappen wouldn’t be surprising as he’s done it before, 2021 Abu Dhabi( little controversial ) but December 7 will decide it all. Buckle up, F1 fans this is one for the history books!🏁
#F1_post
@JrThoughtLab
Will McLaren rise to the occasion and snatch the glory, or will the GOAT, Verstappen, assert his dominance once again? Honestly, a comeback for Verstappen wouldn’t be surprising as he’s done it before, 2021 Abu Dhabi( little controversial ) but December 7 will decide it all. Buckle up, F1 fans this is one for the history books!
#F1_post
@JrThoughtLab
Please open Telegram to view this post
VIEW IN TELEGRAM
I really like how Villa always punish team at the top.
Lowkey happy about Arsenal loss though
Lowkey happy about Arsenal loss though