7
slaat
7y

Can you go faster from 0 to a 100 than drake?

for(int i=0; i<=100; i++) {
Console.WriteLine(i);
}

Show me your fastest way!

Comments
  • 7
    int i = 0;
    i = 100;
    print(i);

    drake takes too long to loop.
  • 2
    I =0:1:100
  • 10
    Console.WriteLine(1);
    Console.WriteLine(2);
    ...
    Console.WriteLine(100);

    ¯\_(ツ)_/¯
  • 3
    for (int i = 0; i != 101; ++i){
    cout << i << '\n';
    }

    As far as c++ cares, this is faster.
  • 2
    a:
    push 4
    call malloc
    mov rdi, rax
    mov rax, 0
    a_loop:
    cmp rax, 100
    jg a_end
    push 10
    push rdi
    push rax
    call itoa ; assumes itoa is defined
    inc rax
    push rdi
    call puts
    jmp a_loop
    a_end:
    push rdi
    call free
    ret

    its pretty hard to type on a phone
    EDIT: fixed a memory leak of 4 bytes
Add Comment