- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
You have two numbers represented by a linked list, where each node contains a single digit.
You have two numbers represented by a linked list, where each NodeAddL contains a single digit.
The digits are stored in reverse order, such that the 1’s digit is at the head of the list.
Write a function that adds the two numbers and returns the sum as a linked list
- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
@ -18,42 +18,42 @@ Change order of linked list so that elements with odd index come first, elements
with even index come afterwards.
You have to return pointer/reference to the beginning of new list
- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
@ -21,7 +20,7 @@ You need to merge them into a new binary tree. The merge rule is that if two nod
Write a function, `MergeTrees`, that returns merged tree .
Note: The merging process must start from the root nodes of both trees.
- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
You are given an integer.
Your function must return sum of all prime numbers prior to the number exclusively. The number is not included.
- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
@ -16,36 +16,38 @@ This means that:
You are given a linked list, where each node contains a single digit.
Write a function that reverses the list and returns pointer/reference to new linked list
### Expected function and struct
### Expected function and structure
```go
package piscine
package main
type Node struct {
Next *Node
type NodeAddL struct {
Next *NodeAddL
Num int
}
func Reverse(node *Node) *Node {
func Reverse(node *NodeAddL) *NodeAddL {
}
```
### Usage
Here is a possible program to test your function:
Here is a possible program to test your function :
- The submitted code needs one declared function main(```func main()```) even if empty.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done.
- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testing are done.
- Every other rules are obviously the same than for a `program`.
### Instructions
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
Write a function, `IsSameTree`, that returns bool.
Write a function, `IsSameTree`, that returns `bool`.