Click here to Skip to main content
15,120,477 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: 25 years of programming reduced to a question. Pin
mdblack9824-Sep-20 3:30
Membermdblack9824-Sep-20 3:30 
GeneralRe: 25 years of programming reduced to a question. Pin
Stefan_Lang24-Sep-20 3:45
mveStefan_Lang24-Sep-20 3:45 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 7:47
professionalJeremy Falcon24-Sep-20 7:47 
GeneralRe: 25 years of programming reduced to a question. Pin
NightPen24-Sep-20 4:39
MemberNightPen24-Sep-20 4:39 
GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 7:11
mvaraddevus24-Sep-20 7:11 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:19
professionalJeremy Falcon24-Sep-20 8:19 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:09
professionalJeremy Falcon24-Sep-20 8:09 
GeneralRe: 25 years of programming reduced to a question. Pin
Martin ISDN24-Sep-20 5:10
MemberMartin ISDN24-Sep-20 5:10 
the best i could get is a one liner on the same idea as @raddevus.
data = [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0];
for (var i = data.length - 2; i >= 0; i--) data.splice(i, !data[i]).length && data.push(0);
all thanks to JavaScript.

i could have never thought of the solution you found on the internet. it's brilliant.

let's C
int d[] = {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0}, *s = d + sizeof d / sizeof *d;
for (int *c = d, *l = d; c < s; c++) if (*c) *l ? *l++ : (*l++ = *c) && (*c = 0);

GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 7:06
mvaraddevus24-Sep-20 7:06 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:22
professionalJeremy Falcon24-Sep-20 8:22 
GeneralRe: 25 years of programming reduced to a question. Pin
raddevus24-Sep-20 8:39
mvaraddevus24-Sep-20 8:39 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:42
professionalJeremy Falcon24-Sep-20 8:42 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:20
professionalJeremy Falcon24-Sep-20 8:20 
GeneralRe: 25 years of programming reduced to a question. Pin
mrmike24-Sep-20 5:28
professionalmrmike24-Sep-20 5:28 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:34
professionalJeremy Falcon24-Sep-20 8:34 
GeneralRe: 25 years of programming reduced to a question. Pin
kmoorevs24-Sep-20 6:39
Memberkmoorevs24-Sep-20 6:39 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:37
professionalJeremy Falcon24-Sep-20 8:37 
GeneralRe: 25 years of programming reduced to a question. Pin
sgtobin24-Sep-20 7:00
Membersgtobin24-Sep-20 7:00 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:38
professionalJeremy Falcon24-Sep-20 8:38 
GeneralRe: 25 years of programming reduced to a question. Pin
patbob24-Sep-20 7:20
Memberpatbob24-Sep-20 7:20 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 8:41
professionalJeremy Falcon24-Sep-20 8:41 
GeneralRe: 25 years of programming reduced to a question. Pin
abmv24-Sep-20 8:57
professionalabmv24-Sep-20 8:57 
GeneralRe: 25 years of programming reduced to a question. Pin
SeattleC++24-Sep-20 9:15
MemberSeattleC++24-Sep-20 9:15 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 9:38
professionalJeremy Falcon24-Sep-20 9:38 
GeneralRe: 25 years of programming reduced to a question. Pin
Jeremy Falcon24-Sep-20 9:43
professionalJeremy Falcon24-Sep-20 9:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.