(/)
0x09 - Netflix interview
Mock interviews are multi-purpose:
• It helps you and the staff understand where you stand in terms of general knowledge
• It helps you and the staff understand where you stand in terms of technical skills
• It is a training for interviews
Mock interviews - How-to ([Link]
Code
Duration: 45 minutes
• Candidate must code on a computer and you should validate outputs and special cases
• Unless specified, candidate is not allowed to use Internet or man
• Candidate have to use Ubuntu 14.0 LTS
• gcc 4
• Python 3
Delete at index
Need more context? access to the project 0x17. C - Doubly linked lists (/projects/240)
Write a function that deletes the node at index index of a dlistint_t linked list.
• Prototype: int delete_dnodeint_at_index(dlistint_t **head, unsigned int index);
• where index is the index of the node that should be deleted. Index starts at 0
• Returns: 1 if it succeeded, -1 if it failed
You are interviewing Juan Sebastian
Time Left: 45 minutes
Current progress: 1/3
Avendano Gonzalez
julien@ubuntu:~/0x17. Doubly linked lists$ cat 8-main.c
(/)
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "lists.h"
/**
* main - check the code
*
* Return: Always EXIT_SUCCESS.
*/
int main(void)
{
dlistint_t *head;
head = NULL;
add_dnodeint_end(&head, 0);
add_dnodeint_end(&head, 1);
add_dnodeint_end(&head, 2);
add_dnodeint_end(&head, 3);
add_dnodeint_end(&head, 4);
add_dnodeint_end(&head, 98);
add_dnodeint_end(&head, 402);
add_dnodeint_end(&head, 1024);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 5);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
You are interviewing Juan Sebastian
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
Time Left: 45 minutes
Current progress: 1/3
Avendano Gonzalez
printf("-----------------\n");
(/) delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
printf("-----------------\n");
delete_dnodeint_at_index(&head, 0);
print_dlistint(head);
return (0);
}
julien@ubuntu:~/0x17. Doubly linked lists$ gcc -Wall -pedantic -Werror -Wextra -std
=gnu89 8-main.c 3-add_dnodeint_end.c 0-print_dlistint.c 4-free_dlistint.c 8-delete_
dnodeint.c -o k
julien@ubuntu:~/0x17. Doubly linked lists$ ./k
0
1
2
3
4
98
402
1024
-----------------
0
1
2
3
4
402
1024
-----------------
1
2
3
4
402
1024
-----------------
2
3
4
402
1024
-----------------
3
4
402
1024You are interviewing Juan Sebastian
-----------------
Time Left: 45 minutes
Current progress: 1/3
4 Avendano Gonzalez
402
(/)
1024
-----------------
402
1024
-----------------
1024
-----------------
-----------------
-----------------
-----------------
-----------------
-----------------
-----------------
-----------------
-----------------
-----------------
julien@ubuntu:~/0x17. Doubly linked lists$
Copyright © 2022 Holberton Inc, All rights reserved.
You are interviewing Juan Sebastian Time Left: 45 minutes
Current progress: 1/3
Avendano Gonzalez