At ALX Holberton School of Software Engineering, specific questions/tasks are treated as interview prep tasks, these tasks are proven and can potentially be interview questions in the future while job hunting. This repository contains many of such prep tasks.
Filename; 10-check_cycle.c
- Question;
Write a function in C that checks if a singly linked list has a cycle in it.
- Prototype:
int check_cycle(listint_t *list);
- Return:
0
if there is no cycle,1
if there is a cycle.
Only these functions are allowed: write
, printf
, putchar
, puts
, malloc
, free
.
Answer can be found in the file therein!
Filename; 13-insert_number.c
- Question;
Write a function in C that inserts a number into a sorted singly linked list.
- Prototype:
listint_t *insert_node(listint_t **head, int number);
- Return: the address of the new node, or
NULL
if it failed.
Answer can be found in the file therein!
Filename; 13-is_palindrome.c
- Question;
Write a function in C that checks if a singly linked list is a palindrome.
- Prototype:
int is_palindrome(listint_t **head);
- Return: 0 if it is not a palindrome, 1 if it is a palindrome.
- An empty list is considered a palindrome.
Answer can be found in the file therein!
Filename; 12-pascal_triangle.py
- Question;
Create a Python function
def pascal_triangle(n):
that returns a list of lists of integers representing the Pascal’s triangle of n:
- Returns an empty list if
n <= 0
. - You can assume n will be always an integer.
- You are not allowed to import any module.
Answer can be found in the file therein!
Filename; lists.h
The lists.h
file is a header file which contains all the standard and custom function prototypes used in solving C programming
related interview prep tasks.