godzilla
BAN USER
- 1of 1 vote
AnswersImagine a computer where you have no "/" (divide) operation. All other operations are implemented including addition, multiplication, binary shift etc. Implement function div(int a, int b) using available operators only.
- godzilla in United States for unknown| Report Duplicate | Flag | PURGE
Riot Gaming Software Engineer Coding - 0of 0 votes
AnswersWhat is the output of following program:
- godzilla in United States for unknown1 #include <stdio.h> 2 3 int r = 1; 4 int numbers[5] = {1, 2, 3, 1, 5 }; 5 6 int main(int argc, char** argv) 7 { 8 #if !defined(_MSC_VER) 9 asm("leal numbers, %esi"); 10 asm("movl $0, %ecx"); 11 asm("movl r, %eax"); 12 asm("label1:"); 13 asm("movl (%esi,%ecx,0x4), %ebx"); 14 asm("imul %ebx, %eax"); 15 asm("addl $1, %ecx"); 16 asm("cmpl $5, %ecx"); 17 asm("jl label1"); 18 asm("mov %eax, r"); 19 #else 20 __asm 21 { 22 LEA ESI, numbers 23 MOV ECX, 0 24 MOV EAX, r 25 label1: 26 MOV EBX, [ESI + ECX * 4] 27 IMUL EAX, EBX 28 ADD ECX, 1 29 CMP ECX, 5 30 JL label1 31 MOV r, EAX 32 } 33 #endif 34 printf("Result= %d\n", r); 35 return 0; 36 }
| Report Duplicate | Flag | PURGE
CareerCup Software Engineer / Developer Assembly - 0of 0 votes
AnswersQuestion 4: Maze Problem (Bonus)
- godzilla in Canada
Starting point is m[0][0], need to find a path go to m[9][9]. 0 means OK, 1 means cannot go there, boundary is 0 and 9, cannot go beyond boundary. Each step can be made horizontally or vertically for one more grid (diagonal
jump is not allowed).
Your program should print a series of grid coordinates that start from m[0][0]
and go to m[9][9]
Hint: No need to find the shortest path, only need to find one path that gets
you to desitination.| Report Duplicate | Flag | PURGE
Fortinet Software Engineer / Developer C - 0of 0 votes
AnswersQuestion 3: Implement Base64 encoding API -
- godzilla in Canada
DESCRIPTION
Base64 processes input in 24bit chunks by converting each chunk into 4 bytes of output. It does so by splitting input into four 6bit groups and using these as indexes in the following substitution table -
const char base64_map[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
If an input is not a multiple of 3 bytes, it's padded with zeros. In this case the output bytes that consist entirely of the pad data are replaced with '='.
Example
An input of 0x00 0x45 0xF2 is equivalent to 00000000 01000101 11110010
bit sequence, which's then split into 000000 000100 010111 110010
and these are substituted to produce the following base64 encoding
'A' 'E' 'X' 'y'| Report Duplicate | Flag | PURGE
Fortinet Software Engineer / Developer - 0of 0 votes
Answer3 hour coding test.
- godzilla in Canada
Question 1: Delete an item in a linked list| Report Duplicate | Flag | PURGE
Fortinet Software Engineer / Developer C
- godzilla February 14, 2018