File tree Expand file tree Collapse file tree 30 files changed +238
-0
lines changed
Expand file tree Collapse file tree 30 files changed +238
-0
lines changed Original file line number Diff line number Diff line change 1+ fscanf($stdin, "%d", $n);
2+ for ($i = 0; $i < $n; $i++)
3+ {
4+ $line = stream_get_line($stdin, 100 + 1, "\n");
5+ }
6+
7+ // Write an answer using echo(). DON'T FORGET THE TRAILING \n
8+
9+ echo("Valid, Invalid or No brackets\n");
Original file line number Diff line number Diff line change 1+ {
2+ "namespace" : " Community\\ Training\\ Medium\\ ValidBracketsInCode" ,
3+ "name" : " Valid brackets in code" ,
4+ "group" : " validBracketsInCode" ,
5+ "link" : " https://www.codingame.com/ide/puzzle/valid-brackets-in-code" ,
6+ "tests" : [
7+ {
8+ "name" : " Test 1" ,
9+ "group" : " test1" ,
10+ "method" : " Test1" ,
11+ "file" : " 01 - test 1.txt"
12+ },
13+ {
14+ "name" : " Test 2" ,
15+ "group" : " test2" ,
16+ "method" : " Test2" ,
17+ "file" : " 02 - test 2.txt"
18+ },
19+ {
20+ "name" : " Test 3" ,
21+ "group" : " test3" ,
22+ "method" : " Test3" ,
23+ "file" : " 03 - test 3.txt"
24+ },
25+ {
26+ "name" : " Test 4" ,
27+ "group" : " test4" ,
28+ "method" : " Test4" ,
29+ "file" : " 04 - test 4.txt"
30+ },
31+ {
32+ "name" : " Test 5" ,
33+ "group" : " test5" ,
34+ "method" : " Test5" ,
35+ "file" : " 05 - test 5.txt"
36+ },
37+ {
38+ "name" : " Test 6" ,
39+ "group" : " test6" ,
40+ "method" : " Test6" ,
41+ "file" : " 06 - test 6.txt"
42+ },
43+ {
44+ "name" : " Test 7" ,
45+ "group" : " test7" ,
46+ "method" : " Test7" ,
47+ "file" : " 07 - test 7.txt"
48+ },
49+ {
50+ "name" : " Test 8" ,
51+ "group" : " test8" ,
52+ "method" : " Test8" ,
53+ "file" : " 08 - test 8.txt"
54+ },
55+ {
56+ "name" : " Test 9" ,
57+ "group" : " test9" ,
58+ "method" : " Test9" ,
59+ "file" : " 09 - test 9.txt"
60+ },
61+ {
62+ "name" : " Test 10" ,
63+ "group" : " test10" ,
64+ "method" : " Test10" ,
65+ "file" : " 10 - test 10.txt"
66+ },
67+ {
68+ "name" : " Test 11" ,
69+ "group" : " test11" ,
70+ "method" : " Test11" ,
71+ "file" : " 11 - test 11.txt"
72+ },
73+ {
74+ "name" : " Test 12" ,
75+ "group" : " test12" ,
76+ "method" : " Test12" ,
77+ "file" : " 12 - test 12.txt"
78+ },
79+ {
80+ "name" : " Test 13" ,
81+ "group" : " test13" ,
82+ "method" : " Test13" ,
83+ "file" : " 13 - test 13.txt"
84+ },
85+ {
86+ "name" : " Test 14" ,
87+ "group" : " test14" ,
88+ "method" : " Test14" ,
89+ "file" : " 14 - test 14.txt"
90+ }
91+ ]
92+ }
Original file line number Diff line number Diff line change 1+ 1
2+ console.log("Hello World!");
Original file line number Diff line number Diff line change 1+ 2
2+ a = [0,1,1,2,3]
3+ puts [a)
Original file line number Diff line number Diff line change 1+ 1
2+ string str = "}why (are[ there) random parenthesis] in here?";
Original file line number Diff line number Diff line change 1+ 1
2+ const evenMoreStrings = "\" \\:)\"\\";
Original file line number Diff line number Diff line change 1+ 7
2+ function getSumOfArray(arr) {
3+ let sum = 0;
4+ for (let i = 0; i < arr.length; i++) {
5+ sum += arr[i];
6+ }
7+ return sum;
8+ }
Original file line number Diff line number Diff line change 1+ 17
2+ public class Main {
3+ public static void main(String[] args) {
4+ int num = 420;
5+ boolean isNotPrime = false;
6+ for (int i = 2; i < num; i++) {
7+ if (num % i == 0) {
8+ isNotPrime = true;
9+ break;
10+ }
11+ }
12+ if (!isNotPrime)
13+ System.out.println(num + " is ({[a prime number})].");
14+ else
15+ System.out.println(num + " is not ({[a prime number})].");
16+ }
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ 50
2+ using System;
3+ namespace powerful_prime_factor
4+ {
5+ class Program
6+ {
7+ public static void Main(string[] args)
8+ {
9+ try
10+ {
11+ int integer = Int32.Parse(args[0]);
12+ if (integer < 0) throw new Exception("Error: input must be positive");
13+ Console.WriteLine("Your factors are:");
14+ string output = ExpressFactors(integer);
15+ Console.WriteLine(output);
16+ }
17+ catch (IndexOutOfRangeException)
18+ {
19+ Console.WriteLine("Error: no integer provided. Usage: dotnet run {integer}");
20+ }
21+ catch (Exception e)
22+ {
23+ Console.WriteLine(e);
24+ }
25+ }
26+ public static string ExpressFactors(int n)
27+ {
28+ int i = 2;
29+ string output = "";
30+ while (n != 1)
31+ {
32+ int count = 0;
33+ while (n % i == 0)
34+ {
35+ n /= i;
36+ count++;
37+ }
38+ if (count != 0)
39+ {
40+ string factor = "";
41+ if (count == 1) factor = i.ToString();
42+ else factor = $"{i}^{count}";
43+ if (output == "") output = factor;
44+ else output += $" x {factor}";
45+ }
46+ i++;
47+ }
48+ return output;
49+ }
50+ }
51+ }
Original file line number Diff line number Diff line change 1+ 12
2+ const fibonacci = (n) => {
3+ if (n < 2) return 1;
4+ let nth = 2;
5+ let cur = 1;
6+ let prev = 1;
7+ while (true) {
8+ if (n == nth) return cur;
9+ let temp = cur;
10+ cur += prev;
11+ prev = temp;
12+ nth++;
13+ };
You can’t perform that action at this time.
0 commit comments