Brief

Sujet public de la manche courante

Sujet Complet

Sujet en cours

Énoncé

Sort the stack

Implement a function that print all the elements from the two stacks received as arguments in ascending order.

Fichier attendu

sort_the_stack.c

Fonction attendue

sort_the_stack

Sortie attendue

string

Print the merged stack in ascending order.

Entrées

Paramètres reçus

stack1

int *

The first stack.

len stack1

int

The number of elements in the first stack.

stack2

int *

The second stack.

len stack2

int

The number of elements in the second stack.

Contraintes

  • None

Exemples

Cas illustratifs

Exemple 1

Input

stack1 = [
  1,
  3,
  5
]
len stack1 = 3
stack2 = [
  2,
  4,
  6
]
len stack2 = 3

Output

[
  1,
  2,
  3,
  4,
  5,
  6
]

Exemple 2

Input

stack1 = [
  1,
  9,
  3
]
len stack1 = 3
stack2 = [
  4,
  5,
  6
]
len stack2 = 3

Output

[
  1,
  3,
  4,
  5,
  6,
  9
]

Exemple 3

Input

stack1 = [
  12,
  4,
  3
]
len stack1 = 3
stack2 = [
  6,
  90,
  8
]
len stack2 = 3

Output

[
  3,
  4,
  6,
  8,
  12,
  90
]

Exemple 4

Input

stack1 = [
  1,
  2,
  3,
  6,
  8,
  12
]
len stack1 = 6
stack2 = [
  1,
  2,
  3
]
len stack2 = 3

Output

[
  1,
  1,
  2,
  2,
  3,
  3,
  6,
  8,
  12
]

Manche

Manche 1

PhaseRelais
Équipes7
InscriptionsFermées

Signature

Prototype Python

void sort_the_stack(int *stack1, int len_stack1, int *stack2, int len_stack2):
Menu