Browse Source

Merge pull request #379 from 01-edu/printchessboard,robottoorigin,twosum

Printchessboard,robottoorigin,twosum
pull/402/head
LEEDASILVA 5 years ago committed by GitHub
parent
commit
4612050a03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      subjects/printchessboard.en.md
  2. 11
      subjects/robottoorigin.en.md
  3. 11
      subjects/twosum.en.md

4
subjects/printchessboard.en.md

@ -2,9 +2,9 @@
### Instructions ### Instructions
Write a program that takes a two integer as argument and displays the chess desk, where white cells `' '` and black cells `'#'`. Write a program that takes two integers as arguments and displays the chess desk, in which white cells are represented by `' '` and black cells by `'#'`.
- If the number of arguments is different from 2, or if the argument is not a positive number, the program displays `Error` followed by a newline (`'\n'`). - If the number of arguments is different from 2, or if the argument is not a positive number, the program displays `Error` followed by a newline (`'\n'`).
### Usage ### Usage

11
subjects/robottoorigin.en.md

@ -7,7 +7,8 @@ There is a robot at position (0, 0) at 2D map.
Write a program, that outputs `true` if robot ends up at the origin (0, 0) after a sequence of moves, otherwise `false`. `\n` should be in the end of line. Write a program, that outputs `true` if robot ends up at the origin (0, 0) after a sequence of moves, otherwise `false`. `\n` should be in the end of line.
Sequence of moves is a string, which characters state for movement direction: Sequence of moves is a string, which characters state for movement direction:
- U - up
- U - up
- D - down - D - down
- R - right - R - right
- L - left - L - left
@ -17,13 +18,13 @@ If the number of arguments is not 1, output `\n`.
### Usage ### Usage
```console ```console
$> go build student@ubuntu:~/[[ROOT]]/test$ go build
$> ./main "UD" student@ubuntu:~/[[ROOT]]/test$ ./main "UD"
true true
$> ./main "LL" student@ubuntu:~/[[ROOT]]/test$ ./main "LL"
false false
``` ```
In first case, the robot moves up and the down. So, it returned back to its origin position. In first case, the robot moves up and the down. So, it returned back to its origin position.
In second example, the robot moves twice to the left. It is 2 positons left from its origin. So, program should output false. In second example, the robot moves twice to the left. It is 2 positions left from its origin, so the program outputs false.

11
subjects/twosum.en.md

@ -11,18 +11,23 @@ This means that:
- 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 testings are done.
- Every other rules are obviously the same than for a `program`. - Every other rules are obviously the same than for a `program`.
### Instructions: ### Instructions
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
Given an array of integers, return indexes of the two numbers such that they add up to a specific target.
If there are more than one solution, return the first one. If there are more than one solution, return the first one.
If there are no solutions, return nil. If there are no solutions, return nil.
Expected function: Expected function :
```go ```go
func TwoSum(nums []int, target int) []int { func TwoSum(nums []int, target int) []int {
} }
``` ```
Here is a possible [program](TODO-LINK) to test your function : Here is a possible [program](TODO-LINK) to test your function :
```go ```go
package main package main

Loading…
Cancel
Save