mirror of https://github.com/01-edu/public.git
Frenchris
6 years ago
committed by
GitHub
12 changed files with 155 additions and 39 deletions
@ -0,0 +1 @@
|
||||
public.01-edu.org |
@ -0,0 +1,30 @@
|
||||
## fprime |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes a positive `int` and displays its prime factors on the standard output, followed by a newline. |
||||
|
||||
- Factors must be displayed in ascending order and separated by `*`, so that the expression in the output gives the right result. |
||||
|
||||
- If the number of parameters is not 1, the program displays a newline. |
||||
|
||||
- The input, when there is one, will always be valid. |
||||
|
||||
Example of output : |
||||
|
||||
```console |
||||
student@ubuntu:~/piscine/test$ go build |
||||
student@ubuntu:~/piscine/test$ ./test 225225 |
||||
3*3*5*5*7*11*13 |
||||
student@ubuntu:~/piscine/test$ ./test 8333325 |
||||
3*3*5*5*7*11*13*37 |
||||
student@ubuntu:~/piscine/test$ ./test 9539 |
||||
9539 |
||||
student@ubuntu:~/piscine/test$ ./test 804577 |
||||
804577 |
||||
student@ubuntu:~/piscine/test$ ./test 42 |
||||
2*3*7 |
||||
student@ubuntu:~/piscine/test$ ./test |
||||
|
||||
student@ubuntu:~/piscine/test$ |
||||
``` |
@ -0,0 +1,26 @@
|
||||
## revWstr |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes a string as a parameter, and prints its words in reverse. |
||||
|
||||
- A word is a sequence of **alphanumerical** characters. |
||||
|
||||
- If the number of parameters is different from 1, the program will display `\n`. |
||||
|
||||
- In the parameters that are going to be tested, there will not be any additional spaces. (meaning that there will not be additionnal spaces at the beginning or at the end of the string, and words will always be separated by exactly one space). |
||||
|
||||
Examples of outputs : |
||||
|
||||
```console |
||||
student@ubuntu:~/piscine/test$ go build |
||||
student@ubuntu:~/piscine/test$ ./test "the time of contempt precedes that of indifference" |
||||
indifference of that precedes contempt of time the |
||||
student@ubuntu:~/piscine/test$ ./test "abcdefghijklm" |
||||
abcdefghijklm |
||||
student@ubuntu:~/piscine/test$ ./test "he stared at the mountain" |
||||
mountain the at stared he |
||||
student@ubuntu:~/piscine/test$ ./test |
||||
|
||||
student@ubuntu:~/piscine/test$ |
||||
``` |
@ -0,0 +1,29 @@
|
||||
## rostring |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes a string and displays this string after rotating it |
||||
one word to the left. |
||||
|
||||
Thus, the first word becomes the last, and others stay in the same order. |
||||
|
||||
A word is a sequence of **alphanumerical** characters. |
||||
|
||||
Words will be separated by only one space in the output. |
||||
|
||||
If the number of arguments is not one, the program displays a newline. |
||||
|
||||
Examples of outputs : |
||||
|
||||
```console |
||||
student@ubuntu:~/piscine/rostring$ go build |
||||
student@ubuntu:~/piscine/rostring$ ./rostring "abc " | cat -e |
||||
abc$ |
||||
student@ubuntu:~/piscine/rostring$ ./rostring "Let there be light" |
||||
there be light There |
||||
student@ubuntu:~/piscine/rostring$ ./rostring " AkjhZ zLKIJz , 23y" |
||||
zLKIJz , 23y AkjhZ |
||||
student@ubuntu:~/piscine/rostring$ ./rostring | cat -e |
||||
$ |
||||
student@ubuntu:~/piscine/rostring$ |
||||
``` |
@ -0,0 +1,37 @@
|
||||
## sortList |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that must: |
||||
|
||||
- Sort the list given as a parameter, using the function cmp to select the order to apply, |
||||
|
||||
- Return a pointer to the first element of the sorted list. |
||||
|
||||
Duplications must remain. |
||||
|
||||
Inputs will always be consistent. |
||||
|
||||
The `type NodeList` must be used. |
||||
|
||||
Functions passed as `cmp` will always return `true` if `a` and `b` are in the right order, otherwise it will return `false`. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func SortList (l *NodeList, cmp func(a,b int) bool) *NodeList{ |
||||
|
||||
} |
||||
``` |
||||
|
||||
- For example, the following function used as `cmp` will sort the list in ascending order : |
||||
|
||||
```go |
||||
func ascending(a, b int) bool{ |
||||
if a <= b { |
||||
return true |
||||
} else { |
||||
return false |
||||
} |
||||
} |
||||
``` |
Loading…
Reference in new issue