Browse Source

fix errors and normalize style in subjects

content-update
Clement Denis 5 years ago committed by Frenchris
parent
commit
2c3592e5fc
  1. 6
      subjects/abort.md
  2. 7
      subjects/activebits.md
  3. 14
      subjects/bool.md
  4. 6
      subjects/btreeapplybylevel.md
  5. 5
      subjects/btreedeletenode.md
  6. 8
      subjects/btreeisbinary.md
  7. 10
      subjects/btreelevelcount.md
  8. 6
      subjects/btreemax.md
  9. 10
      subjects/btreemin.md
  10. 10
      subjects/btreetransplant.md
  11. 10
      subjects/cat.md
  12. 10
      subjects/collatzcountdown.md
  13. 1
      subjects/comcheck.md
  14. 4
      subjects/compact.md
  15. 2
      subjects/countdown.md
  16. 3
      subjects/createelem.md
  17. 2
      subjects/dispfirstpar.md
  18. 2
      subjects/displastpar.md
  19. 2
      subjects/displaya.md
  20. 3
      subjects/displayalpham.md
  21. 3
      subjects/displayalrevm.md
  22. 4
      subjects/displayfile.md
  23. 2
      subjects/displayz.md
  24. 10
      subjects/enigma.md
  25. 4
      subjects/firstword.md
  26. 3
      subjects/fixthemain.md
  27. 2
      subjects/hello.md
  28. 5
      subjects/inter.md
  29. 9
      subjects/join.md
  30. 1
      subjects/lastword.md
  31. 3
      subjects/listat.md
  32. 3
      subjects/listclear.md
  33. 2
      subjects/listfind.md
  34. 3
      subjects/listforeachif.md
  35. 3
      subjects/listlast.md
  36. 2
      subjects/listmerge.md
  37. 2
      subjects/listpushback.md
  38. 2
      subjects/listpushfront.md
  39. 8
      subjects/listpushpara.md
  40. 2
      subjects/listremoveif.md
  41. 2
      subjects/listreverse.md
  42. 3
      subjects/listsize.md
  43. 4
      subjects/listsort.md
  44. 9
      subjects/max.md
  45. 2
      subjects/onlya.md
  46. 3
      subjects/onlyz.md
  47. 6
      subjects/pilot.md
  48. 22
      subjects/point.md
  49. 13
      subjects/rectangle.md
  50. 5
      subjects/repeatalpha.md
  51. 20
      subjects/reversebits.md
  52. 4
      subjects/rot13.md
  53. 2
      subjects/rot14.md
  54. 6
      subjects/searchreplace.md
  55. 4
      subjects/sortlistinsert.md
  56. 2
      subjects/strlen.md
  57. 21
      subjects/swapbits.md
  58. 8
      subjects/switchcase.md
  59. 1
      subjects/union.md
  60. 9
      subjects/unmatch.md
  61. 5
      subjects/wdmatch.md
  62. 2
      subjects/ztail.md

6
subjects/abort.md

@ -1,4 +1,5 @@
## abort
### Instructions
Write a function that returns the the value in the middle of 5 five arguments.
@ -11,7 +12,6 @@ This function must have the following signature.
func Abort(a, b, c, d, e int) int {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

7
subjects/activebits.md

@ -1,4 +1,5 @@
## activebits
### Instructions
Write a function, ActiveBitsthat, that returns the number of active bits (bits with the value 1) in the binary representation of an integer number.
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func ActiveBits(n int) uint {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

14
subjects/bool.md

@ -1,4 +1,4 @@
# Boolean
## Boolean
### Instructions
@ -7,7 +7,6 @@ Create a `.go` file and copy the code below into our file
- The main task is to return a working program.
```go
func printStr(str string) {
arrayStr := []rune(str)
@ -18,7 +17,6 @@ func printStr(str string) {
}
func isEven(nbr int) boolean {
if even(nbr) == 1 {
return yes
} else {
@ -27,7 +25,6 @@ func isEven(nbr int) boolean {
}
func main() {
if isEven(lengthOfArg) == 1 {
printStr(EvenMsg)
} else {
@ -37,10 +34,13 @@ func main() {
```
### Expected output
```go
```console
I have an even number of arguments
```
### Or
```go
```console
I have an odd number of arguments
```
```

6
subjects/btreeapplybylevel.md

@ -1,4 +1,5 @@
## btreeapplybylevel
### Instructions
Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root.
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeApplyByLevel(root *TreeNode, fn interface{}) {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

5
subjects/btreedeletenode.md

@ -1,4 +1,5 @@
## btreedeletenode
### Instructions
Write a function, BTreeDeleteNode, that deletes 'node' from the tree given by root.
@ -24,8 +25,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

8
subjects/btreeisbinary.md

@ -1,4 +1,5 @@
## btreeisbinary
### Instructions
Write a function, BTreeIsBinary, that returns true only if the tree given by root follows the binary search tree properties.
@ -9,9 +10,8 @@ This function must have the following signature.
```go
func BTreeIsBinary(root *TreeNode) bool {
}
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

10
subjects/btreelevelcount.md

@ -1,15 +1,15 @@
## btreelevelcount
### Instructions
Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree)
Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree)
### Expected function
```go
func BTreeLevelCount(root *piscine.TreeNode) int {
}
}
```
### Usage
@ -20,8 +20,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

6
subjects/btreemax.md

@ -1,4 +1,5 @@
## btreemax
### Instructions
Write a function, BTreeMax, that returns the node with the maximum value in the tree given by root
@ -11,7 +12,6 @@ This function must have the following signature.
func BTreeMax(root *TreeNode) *TreeNode {
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {

10
subjects/btreemin.md

@ -1,4 +1,5 @@
## btreemin
### Instructions
Write a function, BTreeMin, that returns the node with the minimum value in the tree given by root
@ -9,9 +10,8 @@ This function must have the following signature.
```go
func BTreeMin(root *TreeNode) *TreeNode {
}
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -42,5 +42,5 @@ And its output :
student@ubuntu:~/student/btreemin$ go build
student@ubuntu:~/student/btreemin$ ./btreemin
1
student@ubuntu:~/student/btreemin$
student@ubuntu:~/student/btreemin$
```

10
subjects/btreetransplant.md

@ -1,4 +1,5 @@
## btreetransplant
### Instructions
In order to move subtrees around within the binary search tree, write a function, BTreeTransplant, which replaces the subtree started by node with the node called 'rplc' in the tree given by root.
@ -9,9 +10,8 @@ This function must have the following signature.
```go
func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode {
}
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -47,5 +47,5 @@ student@ubuntu:~/student/btreetrandsplant$ ./btreetransplant
4
5
7
student@ubuntu:~/student/btreetrandsplant$
student@ubuntu:~/student/btreetrandsplant$
```

10
subjects/cat.md

@ -6,17 +6,17 @@ Write a program that does the same thing as the system's `cat` command-line.
- You don't have to handle options.
- But if just call the program with out arguments it should take a input and print it back
- But if just call the program with out arguments it should take a input and print it back
- In the program folder create two files named `quest8.txt` and `quest8T.txt`.
- Copy to the `quest8.txt` file this :
- "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
- Copy to the `quest8T.txt` file this :
- "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
- "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
- Copy to the `quest8T.txt` file this :
- "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."
- In case of error it should print the error.

10
subjects/collatzcountdown.md

@ -1,4 +1,5 @@
## collatzcountdown
### Instructions
Write a function, CollatzCountdown, that returns the number of steps to reach 1 using the collatz countdown.
@ -9,9 +10,8 @@ The function must have the following signature.
```go
func CollatzCountdown(start int) int {
}
}
```
### Usage
@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -38,5 +38,5 @@ And its output :
student@ubuntu:~/student/collatzcountdown$ go build
student@ubuntu:~/student/collatzcountdown$ ./collatzcountdown
10
student@ubuntu:~/student/collatzcountdown$
student@ubuntu:~/student/collatzcountdown$
```

1
subjects/comcheck.md

@ -13,6 +13,7 @@ func rot14(str string) string {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :

4
subjects/compact.md

@ -4,7 +4,7 @@
Write a function that will take a pointer to a array as parameter and overwrites any element that points to `nil`.
- If you not sure what the function does. It exists in Ruby.
- If you not sure what the function does. It exists in Ruby.
### Expected functions
@ -13,6 +13,7 @@ func Compact(ptr *[]string, length int) int {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :
@ -28,7 +29,6 @@ func main() {
ptr := &array
fmt.Println(Compact(ptr, len(array)))
}
```
And its output :

2
subjects/countdown.md

@ -14,4 +14,4 @@ student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
9876543210
student@ubuntu:~/piscine/test$
```
```

3
subjects/createelem.md

@ -2,7 +2,7 @@
### Instructions
Write a function `CreateElem` that creates a new element of type`Node`.
Write a function `CreateElem` that creates a new element of type`Node`.
### Expected function and structure
@ -14,7 +14,6 @@ type Node struct {
func CreateElem(n *Node, value int) {
}
```
### Usage

2
subjects/dispfirstpar.md

@ -14,4 +14,4 @@ student@ubuntu:~/piscine/test$ ./test "hello there" how are you
hello there
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
```

2
subjects/displastpar.md

@ -16,4 +16,4 @@ student@ubuntu:~/piscine/test$ ./test "hello there"
hello there
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
```

2
subjects/displaya.md

@ -19,4 +19,4 @@ student@ubuntu:~/piscine/test$ ./test "bcvbvA"
a
student@ubuntu:~/piscine/test$ ./test "nbv"
student@ubuntu:~/piscine/test$
```
```

3
subjects/displayalpham.md

@ -1,4 +1,5 @@
## displayalpham
### Instructions
Write a program that displays the alphabet, with even letters in uppercase, and
@ -12,5 +13,5 @@ Example :
student@ubuntu:~/student/displayalpham$ go build
student@ubuntu:~/student/displayalpham$ ./displayalpham | cat -e
aBcDeFgHiJkLmNoPqRsTuVwXyZ$
student@ubuntu:~/student/displayalpham$
student@ubuntu:~/student/displayalpham$
```

3
subjects/displayalrevm.md

@ -1,4 +1,5 @@
## displayalrevm
### Instructions
Write a program that displays the alphabet in reverse, with even letters in
@ -12,5 +13,5 @@ Example :
student@ubuntu:~/student/displayalrevm$ go build
student@ubuntu:~/student/displayalrevm$ ./displayalrevm | cat -e
aBcDeFgHiJkLmNoPqRsTuVwXyZ$
student@ubuntu:~/student/displayalrevm$
student@ubuntu:~/student/displayalrevm$
```

4
subjects/displayfile.md

@ -9,8 +9,8 @@ Write a program that displays, on the standard output, only the content of the f
- The argument of the program should be the name of the file, in this case, `quest8.txt`.
- In case of error it should print:
- `File name missing`.
- `Too many arguments`.
- `File name missing`.
- `Too many arguments`.
### Output:

2
subjects/displayz.md

@ -19,4 +19,4 @@ student@ubuntu:~/piscine/test$ ./test "nbz"
z
student@ubuntu:~/piscine/test$ ./test
z
```
```

10
subjects/enigma.md

@ -1,4 +1,5 @@
## enigma
### Instructions
Write a function called `Enigma` that receives poiters to functions and move its values around to hide them
@ -11,9 +12,8 @@ This function must have the following signature.
```go
func Enigma(a ***int, b *int, c *******int, d ****int) {
}
}
```
### Usage
@ -24,8 +24,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -82,5 +82,5 @@ After using Enigma
6
5
7
student@ubuntu:~/student/enigma$
student@ubuntu:~/student/enigma$
```

4
subjects/firstword.md

@ -22,5 +22,5 @@ student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$ ./test "hello" "there"
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

3
subjects/fixthemain.md

@ -1,4 +1,4 @@
## Fix the Main
## Fix the Main
### Instructions
@ -29,6 +29,7 @@ func IsDoorClose(ptrDoor *Door) bool {
PutStr("Door is close ?")
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :

2
subjects/hello.md

@ -13,4 +13,4 @@ student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello World!
student@ubuntu:~/piscine/test$
```
```

5
subjects/inter.md

@ -2,7 +2,6 @@
### Instructions
Write a program that takes two strings and displays, without doubles, the characters that appear in both strings, in the order they appear in the first one.
- The display will be followed by a `\n`.
@ -17,5 +16,5 @@ student@ubuntu:~/piscine/test$ ./test "padinton" "paqefwtdjetyiytjneytjoeyjnejey
padinto
student@ubuntu:~/piscine/test$ ./test ddf6vewg64f twthgdwthdwfteewhrtag6h4ffdhsd
df6ewg4
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

9
subjects/join.md

@ -1,4 +1,5 @@
## join
### Instructions
Write a function, Join, that returns the elements of a slice strings (arstr) join together in one string. Using the string 'sep' as a separator between each element of the array
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Join(arstr []string, sep string) string {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -40,5 +39,5 @@ And its output :
student@ubuntu:~/student/join$ go build
student@ubuntu:~/student/join$ ./join
hello--how--are--you
student@ubuntu:~/student/join$
student@ubuntu:~/student/join$
```

1
subjects/lastword.md

@ -1,4 +1,5 @@
## lastword
### Instructions
Write a program that takes a string and displays its last word, followed by a

3
subjects/listat.md

@ -4,7 +4,7 @@
Write a function `ListAt` that haves one pointer to the list, `l`, and an `int` as parameters. This function should print a `Node` of the linked list, depending on the number, `nbr`.
- In case of error it should print `nil`
- In case of error it should print `nil`
### Expected function and structure
@ -46,7 +46,6 @@ func main() {
fmt.Println(ListAt(link, 1).Data)
fmt.Println(ListAt(link, 7))
}
```
And its output :

3
subjects/listclear.md

@ -4,7 +4,7 @@
Write a function `ListClear` that delets all `nodes` from a linked list, deleting the link between the list.
- Tip: assign the list's pointer to nil
- Tip: assign the list's pointer to nil
### Expected function and structure
@ -62,7 +62,6 @@ func main() {
fmt.Println("------updated list------")
PrintList(link)
}
```
And its output :

2
subjects/listfind.md

@ -49,7 +49,7 @@ func main() {
piscine.ListPushBack(link, "hello")
piscine.ListPushBack(link, "hello2")
piscine.ListPushBack(link, "hello3")
fmt.Println(piscine.ListFind(link, CompStr))
}
```

3
subjects/listforeachif.md

@ -2,7 +2,7 @@
### Instructions
Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list.
Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list.
- For this you will have to create a function `CompStr`, that returns a `bool`, to compare each elemente of the linked list, to see if it is a string, and than apply the function in the argument of `ListForEachIf`.
@ -62,6 +62,7 @@ func PrintList(l *list) {
fmt.Print(l.tail)
}
func main() {
link := &list{}

3
subjects/listlast.md

@ -18,6 +18,7 @@ type List struct {
}
func ListLast(l *list) *list {
}
```
@ -33,7 +34,6 @@ import (
piscine ".."
)
func main() {
link := &list{}
link2 := &list{}
@ -45,7 +45,6 @@ func main() {
fmt.Println(piscine.ListLast(link).head)
fmt.Println(piscine.ListLast(link2).head)
}
```
And its output :

2
subjects/listmerge.md

@ -22,7 +22,7 @@ type List struct {
}
func listMerge(l1 *List, l2 *List) {
}
```

2
subjects/listpushback.md

@ -34,7 +34,7 @@ import (
)
func main() {
link := &List{}
piscine.ListPushBack(link, "Hello")

2
subjects/listpushfront.md

@ -18,6 +18,7 @@ type List struct {
}
func ListPushFront(l *list, data interface{}) {
}
```
@ -34,7 +35,6 @@ import (
)
func main() {
link := &list{}
piscine.ListPushFront(link, "Hello")

8
subjects/listpushpara.md

@ -1,19 +1,17 @@
## listpushback
## listpushpara
### Instructions
Write a program that creates a new linked list and includes each command-line argument in to the list.
- The first argument should be at the end of the list
```
- The first argument should be at the end of the list
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./listpushparams choumi is the best cat
cat
cat
best
the
is

2
subjects/listremoveif.md

@ -6,7 +6,6 @@ Write a function `ListRemoveIf` that removes all elements that are equal to the
- Use pointers wen ever you can.
### Expected function and structure
```go
@ -80,7 +79,6 @@ func main() {
fmt.Println("------answer-----")
PrintList(link)
}
```
And its output :

2
subjects/listreverse.md

@ -4,7 +4,7 @@
Write a function `ListReverse` that reverses the elements order of a given linked list.
- Use pointers when ever you can
- Use pointers when ever you can
### Expected function and structure

3
subjects/listsize.md

@ -18,7 +18,7 @@ type List struct {
}
func ListSize(l *List) int {
}
```
@ -44,7 +44,6 @@ func main() {
fmt.Println(piscine.ListSize(link))
}
```
And its output :

4
subjects/listsort.md

@ -4,7 +4,7 @@
Write a function `ListSort` that sorts the linked list by ascending order.
- This time you only will have the `Nodee` structure.
- This time you only will have the `Nodee` structure.
- Try to use recursive.
@ -76,9 +76,7 @@ func main() {
listPushBack(link, 1)
PrintList(student.ListSort(link))
}
```
And its output :

9
subjects/max.md

@ -1,4 +1,5 @@
## max
### Instructions
Write a function, Max, that returns the maximum value in a slice of integers
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Max(arr []int) int {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -40,5 +39,5 @@ And its output :
student@ubuntu:~/student/max$ go build
student@ubuntu:~/student/max$ ./max
123
student@ubuntu:~/student/max$
student@ubuntu:~/student/max$
```

2
subjects/onlya.md

@ -2,4 +2,4 @@
### Instructions
Write a program that displays a 'a' character on the standard output.
Write a program that displays a 'a' character on the standard output.

3
subjects/onlyz.md

@ -1,4 +1,5 @@
## displayalpham
### Instructions
Write a program that displays a 'z' character on the standard output.
Write a program that displays a 'z' character on the standard output.

6
subjects/pilot.md

@ -1,4 +1,5 @@
## pilot
### Instructions
Write a go file so that the following program compile
@ -9,8 +10,8 @@ Write a go file so that the following program compile
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -23,4 +24,3 @@ func main() {
fmt.Println(donnie)
}
```

22
subjects/point.md

@ -1,4 +1,4 @@
# Point
## Point
### Instructions
@ -6,21 +6,19 @@ Create a `.go` file and copy the code below into our file
- The main task is to return a working program.
-
```go
func setPoint(ptr *point) {
ptr.x = 42
ptr.y = 21
ptr.x = 42
ptr.y = 21
}
func main() {
points := &point{}
points := &point{}
setPoint(points)
setPoint(points)
fmt.Printf("x = %d, y = %d",points.x, points.y)
fmt.Println()
fmt.Printf("x = %d, y = %d",points.x, points.y)
fmt.Println()
}
```
@ -29,6 +27,6 @@ func main() {
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
x = 42, y = 21
x = 42, y = 21
student@ubuntu:~/piscine/test$
```
```

13
subjects/rectangle.md

@ -13,29 +13,29 @@ is defined by the points of the upper left and lower right corners.
- Our main task is to make a program that:
- Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`
- Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`
- And calculates and prints the area of that rectangle you define.
- And calculates and prints the area of that rectangle you define.
### Expected main and function for the program
```go
func defineRectangle(ptr *point, n int) *rectangle {
//complete here
}
func calArea(ptr *rectangle) int {
//complete here
}
func main() {
vPoint := []point{}
vPoint := []point{}
rectangle := &rectangle{}
n := 7
for i := 0; i < n; i++ {
val := point{
x: i%2 + 1,
x: i%2 + 1,
y: i + 2,
}
vPoint = append(vPoint, val)
@ -45,7 +45,6 @@ func main() {
}
```
### Expected output
```console

5
subjects/repeatalpha.md

@ -1,11 +1,12 @@
## repeatalpha
### Instructions
Write a program called repeat_alpha that takes a string and display it
repeating each alphabetical character as many times as its alphabetical index,
followed by a newline.
'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc...
`'a'` becomes `'a'`, `'b'` becomes `'bb'`, `'e'` becomes `'eeeee'`, etc...
Case remains unchanged.
@ -25,5 +26,5 @@ student@ubuntu:~/student/repeatalpha$ ./repeatalpha | cat -e
$
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "" | cat -e
$
student@ubuntu:~/student/repeatalpha$
student@ubuntu:~/student/repeatalpha$
```

20
subjects/reversebits.md

@ -1,4 +1,5 @@
## reversebits
### Instructions
Write a function that takes a byte, reverses it, bit by bit (like the
@ -6,15 +7,20 @@ example) and returns the result.
Your function must be declared as follows:
```go
func ReverseBits(octet byte) byte {
...
}
```
Example:
1 byte
_____________
00100110
||
\/
01100100
1 byte
---
```
00100110
||
\/
01100100
```

4
subjects/rot13.md

@ -21,5 +21,5 @@ student@ubuntu:~/piscine/test$ ./test "hello there"
uryyb gurer
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

2
subjects/rot14.md

@ -13,6 +13,7 @@ func rot14(str string) string {
}
```
### Usage
Here is a possible [program](TODO-LINK) to test your function :
@ -33,7 +34,6 @@ func main() {
}
z01.PrintRune('\n')
}
```
And its output :

6
subjects/searchreplace.md

@ -2,7 +2,7 @@
### Instructions
Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument).
Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument).
- If the number of arguments is not 3, just display a newline.
@ -18,5 +18,5 @@ student@ubuntu:~/piscine/test$ ./test "abcd" "z" "l"
abcd
student@ubuntu:~/piscine/test$ ./test "something" "a" "o" "b" "c"
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

4
subjects/sortlistinsert.md

@ -4,7 +4,7 @@
Write a function `SortListInsert` that inserts `Data_ref` in the linked list, but it as to remain sorted in ascending order.
- The list as to be alredy sorted.
- The list as to be alredy sorted.
- Use pointers when ever you can.
@ -43,6 +43,7 @@ func PrintList(l *Nodee) {
fmt.Print(nil)
fmt.Println()
}
//insert elements
func listPushBack(l *Nodee, Data int) {
n := &Nodee{}
@ -73,7 +74,6 @@ func main() {
link = sortListInsert(link, 2)
PrintList(link)
}
```
And its output :

2
subjects/strlen.md

@ -4,7 +4,7 @@
Write a function that returns the length of a string.
- `len` is forbidden
- `len` is forbidden
### Expected function and structure

21
subjects/swapbits.md

@ -1,4 +1,5 @@
## swapbits
### Instructions
Write a function that takes a byte, swaps its halves (like the example) and
@ -6,15 +7,21 @@ returns the result.
Your function must be declared as follows:
```go
func SwapBits(octet byte) byte {
...
}
```
Example:
1 byte
_____________
0100 | 0001
\ /
/ \
0001 | 0100
1 byte
---
```
0100 | 0001
\ /
/ \
0001 | 0100
````

8
subjects/switchcase.md

@ -2,7 +2,7 @@
### Instructions
Write a program that takes a string and reverses the case of all its letters.
Write a program that takes a string and reverses the case of all its letters.
- Other characters remain unchanged.
@ -16,7 +16,7 @@ Write a program that takes a string and reverses the case of all its letters.
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test "SometHingS iS WronG"
sOMEThINGs Is wRONg
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

1
subjects/union.md

@ -1,4 +1,5 @@
## union
### Instructions
Write a program that takes two strings and displays, without doubles, the

9
subjects/unmatch.md

@ -1,4 +1,5 @@
## join
### Instructions
Write a function, Unmatch, that returns the element of the slice (arr) that does not have a correspondent pair.
@ -8,11 +9,9 @@ The function must have the next signature.
### Expected function
```go
func Unmatch(arr []int) int {
}
```
### Usage
@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function :
package main
import (
"fmt"
student ".."
"fmt"
student ".."
)
func main() {
@ -40,5 +39,5 @@ And its output :
student@ubuntu:~/student/unmatch$ go build
student@ubuntu:~/student/unmatch$ ./unmatch
4
student@ubuntu:~/student/unmatch$
student@ubuntu:~/student/unmatch$
```

5
subjects/wdmatch.md

@ -2,7 +2,6 @@
### Instructions
Write a program that takes two strings and checks whether it's possible to write the first string with characters from the second string, while respecting the order in which these characters appear in the second string.
- If it's possible, the program displays the string followed by a `\n`, otherwise it simply displays a `\n`.
@ -21,5 +20,5 @@ student@ubuntu:~/piscine/test$ ./test "error"
student@ubuntu:~/piscine/test$ ./test
student@ubuntu:~/piscine/test$
```
student@ubuntu:~/piscine/test$
```

2
subjects/ztail.md

@ -1,4 +1,5 @@
## ztail
### Instructions
Write a program called ztail that does the same thing as the system command tail, but witch takes at least one file as argument.
@ -10,4 +11,3 @@ For this program you can use the "os" package.
For the program to pass the test you should follow the convention for the return code of program in Unix sistems (see os.Exit)
For more information consult the man page for tail.

Loading…
Cancel
Save