-
-
Save izy521/bcd30d575b2a9128980e61b211aa3ec0 to your computer and use it in GitHub Desktop.
| package main | |
| import ( | |
| "bufio" | |
| "os" | |
| "strconv" | |
| "fmt" | |
| "log" | |
| "strings" | |
| ) | |
| func main() { | |
| var ( | |
| scanner *bufio.Scanner; | |
| iterations int; | |
| calculated_values []int; | |
| ) | |
| scanner = bufio.NewScanner(os.Stdin); | |
| iterations = read_iterations(scanner); | |
| calculated_values = make([]int, iterations); | |
| process_numbers_recursive(scanner, &calculated_values, 0, iterations); | |
| print_values_recursive(calculated_values); | |
| os.Exit(0); | |
| } | |
| func read_iterations(scanner *bufio.Scanner) int { | |
| scanner.Scan(); | |
| n, err := strconv.Atoi(scanner.Text()); | |
| if err != nil { | |
| log.Fatal(err); | |
| } | |
| return n; | |
| } | |
| func process_numbers_recursive(scanner *bufio.Scanner, calculated_values *[]int, iteration int, iterations int) { | |
| if ( iteration > (iterations - 1) ) { return; } | |
| //Skip amount of numbers | |
| scanner.Scan(); | |
| //String split the actual numbers | |
| scanner.Scan(); | |
| numbers_slice := strings.Split(scanner.Text(), " "); | |
| solution := calculate_square_recurisve(numbers_slice); | |
| (*calculated_values)[iteration] = solution; | |
| process_numbers_recursive(scanner, calculated_values, iteration + 1, iterations); | |
| } | |
| func calculate_square_recurisve(number_slice []string) int { | |
| if ( len(number_slice) <= 0 ) { return 0; } | |
| number, err := strconv.Atoi(number_slice[0]); | |
| if ( err != nil ) { | |
| log.Fatal(err); | |
| } | |
| if ( number <= 0 ) { | |
| return calculate_square_recurisve(number_slice[1:]) | |
| } | |
| return (number * number) + calculate_square_recurisve(number_slice[1:]); | |
| } | |
| func print_values_recursive(calculated_values []int) { | |
| if ( len(calculated_values) < 1 ) { return; } | |
| fmt.Println( calculated_values[0] ); | |
| print_values_recursive( calculated_values[1:] ); | |
| } |
hey, did you get invited for HR and tech interviews? did you get the selected for GIP?
hey, did you get invited for HR and tech interviews? did you get the selected for GIP?
I'm not sure, this did get me an interview but only one before I was rejected. This was back in 2019 though, the company is probably different now.
hey, did you get invited for HR and tech interviews? did you get the selected for GIP?
I'm not sure, this did get me an interview but only one before I was rejected. This was back in 2019 though, the company is probably different now.
Any idea why you got rejected??
hey, did you get invited for HR and tech interviews? did you get the selected for GIP?
I'm not sure, this did get me an interview but only one before I was rejected. This was back in 2019 though, the company is probably different now.
Any idea why you got rejected??
No, but I'm in the US. I was hoping to get some sort of sponsorship to live in Japan, but it's possible they weren't considering that at the moment. I just got the generic "we've moved onto other candidates" email. The challenge wasn't hard, and they seemed nice in the interview.
This was the code used to get me an interview at the Japanese company HENNGE, for a Back-End Software Developer.
The request was to make a script/program that handled an input stream of numbers and (ignoring negatives) square them, and add each together without using a for loop.
e.g.
2(iterations)4(first iteration has 4 numbers)5 32 -5 44(4 numbers)5(second iteration has 5 numbers)9 -1 81 72 -33(5 numbers)would return
298511826