From 0b7c79c4bcc9072e23e4fb9aa9a94d96c02bb648 Mon Sep 17 00:00:00 2001 From: whiterd Date: Sun, 8 Jan 2017 22:30:54 -0600 Subject: [PATCH 01/95] challenge_0 in python --- challenge_0/python/whiterd/README.md | 0 challenge_0/python/whiterd/src/hello_world.py | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 challenge_0/python/whiterd/README.md create mode 100644 challenge_0/python/whiterd/src/hello_world.py diff --git a/challenge_0/python/whiterd/README.md b/challenge_0/python/whiterd/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/challenge_0/python/whiterd/src/hello_world.py b/challenge_0/python/whiterd/src/hello_world.py new file mode 100644 index 000000000..b11ed0060 --- /dev/null +++ b/challenge_0/python/whiterd/src/hello_world.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +from __future__ import print_function + +print('Hello World!') From da18a034d8b67d4dfcab44174c9c9a8ff254defe Mon Sep 17 00:00:00 2001 From: ning Date: Mon, 9 Jan 2017 18:10:07 +0800 Subject: [PATCH 02/95] Challenge #7: Add solution in python --- challenge_7/python/ning/README.md | 10 +++++ challenge_7/python/ning/alt_test.py | 54 ++++++++++++++++++++++++++ challenge_7/python/ning/challenge_7.py | 10 +++++ challenge_7/python/ning/test.py | 54 ++++++++++++++++++++++++++ challenge_7/python/ning/time.py | 54 ++++++++++++++++++++++++++ 5 files changed, 182 insertions(+) create mode 100644 challenge_7/python/ning/README.md create mode 100644 challenge_7/python/ning/alt_test.py create mode 100644 challenge_7/python/ning/challenge_7.py create mode 100644 challenge_7/python/ning/test.py create mode 100644 challenge_7/python/ning/time.py diff --git a/challenge_7/python/ning/README.md b/challenge_7/python/ning/README.md new file mode 100644 index 000000000..c89c1e469 --- /dev/null +++ b/challenge_7/python/ning/README.md @@ -0,0 +1,10 @@ +# Challenge 7, Find The Missing Number + +1. Our solution for challenge 7 comes in the form of a function `find_missing`, taking a paramter of list `input_list`. +2. We first create a set `input_set` from `input_list`. This is as it is faster to check if an element is in a set than in a list, in python. +3. We find the minimum and maximum of `input_list`, i.e. the range of the 'list of numbers from 0 to N-1'. +4. We iterate through this range from smallest to largest, checking for each integer if it exists in `input_set` (and therefore `input_list`). If it does not exist (i.e. is _missing_ from the `input_set`), return the integer. + +## Learning Points + +None so far. Which is suspicious, given that this is apparently a popular interview question. diff --git a/challenge_7/python/ning/alt_test.py b/challenge_7/python/ning/alt_test.py new file mode 100644 index 000000000..79bcc3d93 --- /dev/null +++ b/challenge_7/python/ning/alt_test.py @@ -0,0 +1,54 @@ +'''unit test for challenge 7 by ning +Feel free to make a copy under your +directory and use/modify as you like.''' + +import unittest +from challenge_7 import alt_find_missing + +class Tests(unittest.TestCase): + def test_small(self): + self.assertEqual( + alt_find_missing([0, 1, 3]), + 2 + ) + + def test_medium(self): + self.assertEqual( + alt_find_missing([0, 1, 2, 3, 4, 6, 7, 8, 9, 10]), + 5 + ) + + def test_large(self): + self.assertEqual( + alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]), + 21 + ) + + def test_larger(self): + self.assertEqual( + alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200]), + 125 + ) + + def test_negative(self): + self.assertEqual( + alt_find_missing([-10, -9, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), + -8 + ) + + def test_unsorted(self): + self.assertEqual( + alt_find_missing([4, 2, 1, 5, 0]), + 3 + ) + + def test_unsorted_negative(self): + self.assertEqual( + alt_find_missing([-5, 5, -4, 3, -3, 2, -2, 1, -1, 0]), + 4 + ) + + +if __name__ == '__main__': + unittest.main() + diff --git a/challenge_7/python/ning/challenge_7.py b/challenge_7/python/ning/challenge_7.py new file mode 100644 index 000000000..93400c1db --- /dev/null +++ b/challenge_7/python/ning/challenge_7.py @@ -0,0 +1,10 @@ +def find_missing(input_list): + input_set = set(input_list) + for i in range(min(input_list), max(input_list)+1): + if i not in input_set: + return i + +def alt_find_missing(input_list): + input_sum = sum(input_list) + range_sum = sum([i for i in range(min(input_list), max(input_list)+1)]) + return range_sum - input_sum diff --git a/challenge_7/python/ning/test.py b/challenge_7/python/ning/test.py new file mode 100644 index 000000000..f2e5431c2 --- /dev/null +++ b/challenge_7/python/ning/test.py @@ -0,0 +1,54 @@ +'''unit test for challenge 7 by ning +Feel free to make a copy under your +directory and use/modify as you like.''' + +import unittest +from challenge_7 import find_missing + +class Tests(unittest.TestCase): + def test_small(self): + self.assertEqual( + find_missing([0, 1, 3]), + 2 + ) + + def test_medium(self): + self.assertEqual( + find_missing([0, 1, 2, 3, 4, 6, 7, 8, 9, 10]), + 5 + ) + + def test_large(self): + self.assertEqual( + find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]), + 21 + ) + + def test_larger(self): + self.assertEqual( + find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200]), + 125 + ) + + def test_negative(self): + self.assertEqual( + find_missing([-10, -9, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), + -8 + ) + + def test_unsorted(self): + self.assertEqual( + find_missing([4, 2, 1, 5, 0]), + 3 + ) + + def test_unsorted_negative(self): + self.assertEqual( + find_missing([-5, 5, -4, 3, -3, 2, -2, 1, -1, 0]), + 4 + ) + + +if __name__ == '__main__': + unittest.main() + diff --git a/challenge_7/python/ning/time.py b/challenge_7/python/ning/time.py new file mode 100644 index 000000000..ce7d41043 --- /dev/null +++ b/challenge_7/python/ning/time.py @@ -0,0 +1,54 @@ +import timeit +from challenge_7 import find_missing, alt_find_missing + +print('List with 4 elements, using for ... in set (x 1 000 000)') +print(timeit.timeit( + stmt='find_missing([0, 1, 2, 4,])', + setup='from __main__ import find_missing', + number=1000000)) + +print('List with 4 elements, using difference of sums (x 1 000 000)') +print(timeit.timeit( + stmt='alt_find_missing([0, 1, 2, 4,])', + setup='from __main__ import alt_find_missing', + number=1000000)) + +print('List with 100 elements, using for ... in set (x 1 000 000)') +print(timeit.timeit( + stmt='find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])', + setup='from __main__ import find_missing', + number=1000000)) + +print('List with 100 elements, using difference of sums (x 1 000 000)') +print(timeit.timeit( + stmt='alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])', + setup='from __main__ import alt_find_missing', + number=1000000)) + +print('List with 1000 elements, using for ... in set (x 100 000)') +print(timeit.timeit( + stmt='find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000])', + setup='from __main__ import find_missing', + number=100000)) + +print('List with 1000 elements, using difference of sums (x 100 000)') +print(timeit.timeit( + stmt='alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000])', + setup='from __main__ import alt_find_missing', + number = 100000)) + +'''OUTPUT +List with 4 elements, using for ... in set (x 1 000 000) +1.1550223514080038 +List with 4 elements, using difference of sums (x 1 000 000) +1.391524411772641 +List with 100 elements, using for ... in set (x 1 000 000) +8.43574248785071 +List with 100 elements, using difference of sums (x 1 000 000) +8.94695660741872 +List with 1000 elements, using for ... in set (x 100 000) +8.1138781071155 +List with 1000 elements, using difference of sums (x 100 000) +8.383110816298519 +''' + From b1189972d1d169011677ce844233ea42e8684be8 Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Mon, 9 Jan 2017 09:01:21 -0600 Subject: [PATCH 03/95] [C] Challenge 5 (Unreviewed) --- challenge_5/C/karanchawla/src/README.md | 13 +++ challenge_5/C/karanchawla/src/challenge5.c | 109 +++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 challenge_5/C/karanchawla/src/README.md create mode 100644 challenge_5/C/karanchawla/src/challenge5.c diff --git a/challenge_5/C/karanchawla/src/README.md b/challenge_5/C/karanchawla/src/README.md new file mode 100644 index 000000000..1fa8473ca --- /dev/null +++ b/challenge_5/C/karanchawla/src/README.md @@ -0,0 +1,13 @@ +''' +Karan Chawla +Challenge #5 +''' + +# Approach + +Use random number generator along with the size of the string to shuffle characters of the input string. +Add a character to this shuffled string. +Sort the two strings and compare to return the added character. + +To Do: +[ ] Change the random position based implementation to account for the edge case when length(s) = 0 \ No newline at end of file diff --git a/challenge_5/C/karanchawla/src/challenge5.c b/challenge_5/C/karanchawla/src/challenge5.c new file mode 100644 index 000000000..b5d72f316 --- /dev/null +++ b/challenge_5/C/karanchawla/src/challenge5.c @@ -0,0 +1,109 @@ +/* +Author: Karan Chawla +Challenege #5 +Expected Running time O(k + n log n) +where k is the position of the char in the new sorted string +*/ + +#include +#include +#include +#include + + +//utility function used by qsort to sort the strings +int comp (const void * elem1, const void * elem2) +{ + char f = *((char*)elem1); + char s = *((char*)elem2); + if (f > s) return 1; + if (f < s) return -1; + return 0; +} + +//function to shuffle the string +void shuffle(char *array, size_t n) +{ + if (n > 1) + { + size_t i; + for (i = 0; i < n - 1; i++) + { + size_t j = i + rand() / (RAND_MAX / (n - i) + 1); + char t = array[j]; + array[j] = array[i]; + array[i] = t; + } + } +} + +//utility function to print array +void printArray(char *a, int size) +{ + for(int i=0;i Date: Mon, 9 Jan 2017 12:36:21 -0600 Subject: [PATCH 04/95] challenge_1 in python --- challenge_1/python/whiterd/README.md | 4 ++++ challenge_1/python/whiterd/src/reverse_me.py | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 challenge_1/python/whiterd/README.md create mode 100644 challenge_1/python/whiterd/src/reverse_me.py diff --git a/challenge_1/python/whiterd/README.md b/challenge_1/python/whiterd/README.md new file mode 100644 index 000000000..cbb35a8d0 --- /dev/null +++ b/challenge_1/python/whiterd/README.md @@ -0,0 +1,4 @@ + +Input: string + +Output: a reversed string of the given input \ No newline at end of file diff --git a/challenge_1/python/whiterd/src/reverse_me.py b/challenge_1/python/whiterd/src/reverse_me.py new file mode 100644 index 000000000..506121778 --- /dev/null +++ b/challenge_1/python/whiterd/src/reverse_me.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +from __future__ import print_function + +user_input = input('Enter text to be reversed: ') + +print(user_input[::-1]) From e7221e12a51a9f51fafaaaa3a477cb18bd86dc2f Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Mon, 9 Jan 2017 16:41:43 -0600 Subject: [PATCH 05/95] [C] Challenge 8 (Unreviewed) --- challenge_8/C/README.md | 11 ++++ challenge_8/C/randomDeepCopy.c | 111 +++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 challenge_8/C/README.md create mode 100644 challenge_8/C/randomDeepCopy.c diff --git a/challenge_8/C/README.md b/challenge_8/C/README.md new file mode 100644 index 000000000..d0f990a65 --- /dev/null +++ b/challenge_8/C/README.md @@ -0,0 +1,11 @@ +``` +Karan Chawla +Challenge #8 +``` + +## Approach +Okay so I took the easy way of just copying each node +right after each node in the first list and copying the random node data to +the new nodes. Once this is achieved, separate the two lists. (Phew finally no Seg faults) + +*Includes an example with 5 nodes.* \ No newline at end of file diff --git a/challenge_8/C/randomDeepCopy.c b/challenge_8/C/randomDeepCopy.c new file mode 100644 index 000000000..23c463f90 --- /dev/null +++ b/challenge_8/C/randomDeepCopy.c @@ -0,0 +1,111 @@ +/* +Author: karanchawla +Random Deep Copy +#Challenge #8 +*/ + +#include +#include + + +//node definition for the linked list +struct node +{ + int data; + struct node* next; + struct node* random; +}; + +typedef struct node* Node; + +//utility function to create a node +Node newNode(int key) +{ + Node temp = (struct node*) malloc(sizeof(struct node)); + + temp->data = key; + temp->next = NULL; + temp->random = NULL; + + return temp; +} + +//utility function to print the list +void printList(Node head) +{ + while(head!=NULL) + { + printf("Node key: %d\t", head->data); + printf("Random Node pointer data: %d\n", head->random->data); + head = head->next; + } + return; +} + +//First step is to insert a copy of each node +//after the first node in the original list +//Copy the random pointers +//Separate this second list +Node deepCopy(Node head) +{ + Node old; + Node temp = head; + //modify this list + while(temp) + { + + Node temp2 = newNode(temp->data); + old = temp->next; + temp->next = temp2; + temp2->next = old; + temp = old; + } + + temp = head; + //copy arbitrary matching + while(temp && temp->next) + { + + temp->next->random = temp->random->next; + temp = temp->next->next; + } + + //Separating the two lists + Node newNode = head->next; + temp = head; + + while(temp) + { + old = temp->next; + temp->next = old->next; + temp = old->next; + if(old->next) old->next->next; + } + + return newNode; +} + +//Driver program; +int main(void) +{ + Node head = newNode(1); + head->next = newNode(2); + head->next->next = newNode(3); + head->next->next->next = newNode(4); + head->next->next->next->next = newNode(5); + head->next->next->next->next->next = NULL; + + // Assign random Pointers + head->random = head->next->next; + head->next->random = head->next->next->next; + head->next->next->random = head; + head->next->next->next->random = head->next; + head->next->next->next->next->random = head->next->next->next->next; + + printList(head); + Node deepCopyList = deepCopy(head); + + printList(deepCopyList); + + return 0; +} \ No newline at end of file From 18c003a5db18d4d4847a80a1df708c77694457da Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Mon, 9 Jan 2017 17:04:46 -0600 Subject: [PATCH 06/95] [C] Challenge 8 (Pending) --- challenge_8/C/randomDeepCopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge_8/C/randomDeepCopy.c b/challenge_8/C/randomDeepCopy.c index 23c463f90..dfa8bb14b 100644 --- a/challenge_8/C/randomDeepCopy.c +++ b/challenge_8/C/randomDeepCopy.c @@ -63,7 +63,7 @@ Node deepCopy(Node head) temp = head; //copy arbitrary matching - while(temp && temp->next) + while(temp && temp->next && temp->random) { temp->next->random = temp->random->next; From f4664fe47c03100c60c767b105681c0c2a9d715c Mon Sep 17 00:00:00 2001 From: whiterd Date: Mon, 9 Jan 2017 19:26:14 -0600 Subject: [PATCH 07/95] [Python] Challenge_2 --- challenge_2/python/whiterd/README.md | 4 ++++ .../python/whiterd/src/find_distinct.py | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 challenge_2/python/whiterd/README.md create mode 100644 challenge_2/python/whiterd/src/find_distinct.py diff --git a/challenge_2/python/whiterd/README.md b/challenge_2/python/whiterd/README.md new file mode 100644 index 000000000..4a3e4601b --- /dev/null +++ b/challenge_2/python/whiterd/README.md @@ -0,0 +1,4 @@ + +Input: a list of integers. + +Output: the only non-repeated integer. \ No newline at end of file diff --git a/challenge_2/python/whiterd/src/find_distinct.py b/challenge_2/python/whiterd/src/find_distinct.py new file mode 100644 index 000000000..a0a44bc76 --- /dev/null +++ b/challenge_2/python/whiterd/src/find_distinct.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +''' + Input: An array of random integers where every integer is repeated except + for a single one. + + Output: The single integer that does NOT repeat. +''' + +from __future__ import print_function + +array_1 = [2,3,4,2,3,5,4,6,4,6,9,10,9,8,7,8,10,7] +array_2 = [2,'a','l',3,'l',4,'k',2,3,4,'a',6,'c',4,'m',6,'m','k',9,10,9,8,7,8,10,7] + +def find_distinct(array): + for i in array: + if array.count(i) == 1: + return i + + +if __name__ == '__main__': + print(find_distinct(array_1)) + print(find_distinct(array_2)) From 0bc2f1f3e71559e5d1ad008d07c9927427844e0e Mon Sep 17 00:00:00 2001 From: whiterd Date: Mon, 9 Jan 2017 22:01:45 -0600 Subject: [PATCH 08/95] [Python] Challenge_3 --- challenge_3/python/whiterd/README.md | 8 ++++++++ challenge_3/python/whiterd/src/find_major.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 challenge_3/python/whiterd/README.md create mode 100644 challenge_3/python/whiterd/src/find_major.py diff --git a/challenge_3/python/whiterd/README.md b/challenge_3/python/whiterd/README.md new file mode 100644 index 000000000..c90d61dbf --- /dev/null +++ b/challenge_3/python/whiterd/README.md @@ -0,0 +1,8 @@ +Find Majority Element +--------------------- + +* Given an array of size n, find the majority element. The majority element is the element that appears more than n/2 times. + +* Assume: + * the array is non-empty. + * the majority element always exist in the array. \ No newline at end of file diff --git a/challenge_3/python/whiterd/src/find_major.py b/challenge_3/python/whiterd/src/find_major.py new file mode 100644 index 000000000..f712576fd --- /dev/null +++ b/challenge_3/python/whiterd/src/find_major.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +''' + Input: An array of integers. + + Output: The single integer that occurs most often. +''' + +from __future__ import print_function +from collections import Counter + +given_array = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7] + +def find_major(array): + counted = Counter(array) + return counted.most_common(1)[0][0] + + +print(find_major(given_array)) From cee9ece48e11efadec43242386f46bff11991dc7 Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Tue, 10 Jan 2017 07:01:23 -0600 Subject: [PATCH 09/95] [C] Challenge 5 and Challenege 8(Pending) --- challenge_5/C/karanchawla/src/challenge5.c | 87 ++++++++++++---------- challenge_8/C/randomDeepCopy.c | 51 ++++++++----- 2 files changed, 81 insertions(+), 57 deletions(-) diff --git a/challenge_5/C/karanchawla/src/challenge5.c b/challenge_5/C/karanchawla/src/challenge5.c index b5d72f316..9ab467a76 100644 --- a/challenge_5/C/karanchawla/src/challenge5.c +++ b/challenge_5/C/karanchawla/src/challenge5.c @@ -27,9 +27,11 @@ void shuffle(char *array, size_t n) if (n > 1) { size_t i; - for (i = 0; i < n - 1; i++) + for (i = 0; i < n; i++) { - size_t j = i + rand() / (RAND_MAX / (n - i) + 1); + //size_t j = i + rand() / (RAND_MAX / (n - i)); + size_t j = rand()%n ; + printf("%s\n", array); char t = array[j]; array[j] = array[i]; array[i] = t; @@ -47,63 +49,72 @@ int main(void) { srand(time(NULL)); - //First string cannot be empty + char s[] = "alkugfv"; int size = sizeof(s)/sizeof(*s); char t[size + 1]; strcpy(t,s); - //edge case - if(size==0) - continue; - else + //if first string 's' is not empty + if(size!=0) + { shuffle(s,size-1); - //Insert the char e at a random position - int pos = rand() % (size-1); - - for(int i=0;idata = key; temp->next = NULL; @@ -31,12 +31,20 @@ Node newNode(int key) } //utility function to print the list -void printList(Node head) +void printList(Node* head) { while(head!=NULL) { - printf("Node key: %d\t", head->data); - printf("Random Node pointer data: %d\n", head->random->data); + if(head->random!=NULL) + { + printf("Node key: %d\t", head->data); + printf("Random Node pointer data: %d\n", head->random->data); + } + else + { + printf("Node key: %d\t", head->data); + printf("Random Node pointer data: NULL\n"); + } head = head->next; } return; @@ -46,15 +54,15 @@ void printList(Node head) //after the first node in the original list //Copy the random pointers //Separate this second list -Node deepCopy(Node head) +Node* deepCopy(Node* head) { - Node old; - Node temp = head; + Node* old; + Node* temp = head; //modify this list while(temp) { - Node temp2 = newNode(temp->data); + Node* temp2 = newNode(temp->data); old = temp->next; temp->next = temp2; temp2->next = old; @@ -63,15 +71,20 @@ Node deepCopy(Node head) temp = head; //copy arbitrary matching - while(temp && temp->next && temp->random) + while(temp && temp->next) { - - temp->next->random = temp->random->next; + if(temp->random==NULL) + { + temp->next->random = NULL; + } + else + temp->next->random = temp->random->next; + temp = temp->next->next; } //Separating the two lists - Node newNode = head->next; + Node* newNode = head->next; temp = head; while(temp) @@ -88,7 +101,7 @@ Node deepCopy(Node head) //Driver program; int main(void) { - Node head = newNode(1); + Node* head = newNode(1); head->next = newNode(2); head->next->next = newNode(3); head->next->next->next = newNode(4); @@ -98,12 +111,12 @@ int main(void) // Assign random Pointers head->random = head->next->next; head->next->random = head->next->next->next; - head->next->next->random = head; + head->next->next->random = NULL; head->next->next->next->random = head->next; head->next->next->next->next->random = head->next->next->next->next; printList(head); - Node deepCopyList = deepCopy(head); + Node* deepCopyList = deepCopy(head); printList(deepCopyList); From 69162ff377565aa24b7355c47efa587bcf674c88 Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Tue, 10 Jan 2017 08:08:31 -0600 Subject: [PATCH 10/95] [C] Challenege 10(Pending) --- challenge_10/C/karanchawla/README.md | 10 ++ challenge_10/C/karanchawla/challenge10.c | 172 +++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 challenge_10/C/karanchawla/README.md create mode 100644 challenge_10/C/karanchawla/challenge10.c diff --git a/challenge_10/C/karanchawla/README.md b/challenge_10/C/karanchawla/README.md new file mode 100644 index 000000000..2f3ce0769 --- /dev/null +++ b/challenge_10/C/karanchawla/README.md @@ -0,0 +1,10 @@ +''' +Karan Chawla +Challenge #10 +''' + +This was an easy one. I used a stack to push the first ocurrences of open paranthesis and when a +closing paranthesis is encountered - popped an element from the stack and compared it to the +current element. If they "match"(for eg: '(' with ')') for every occurence - the program returns +True else returns False. + diff --git a/challenge_10/C/karanchawla/challenge10.c b/challenge_10/C/karanchawla/challenge10.c new file mode 100644 index 000000000..d057006e0 --- /dev/null +++ b/challenge_10/C/karanchawla/challenge10.c @@ -0,0 +1,172 @@ +/* +karanchawla +Challenge #10 +Check for balanced paranthesis +Using stack to check if the matching pair exists or not +*/ + +#include +#include +#include +#include + +#ifndef OK +#define OK 0 +#endif + +#ifndef NO_INPUT +#define NO_INPUT 1 +#endif + +#ifndef TOO_LONG +#define TOO_LONG 2 +#endif + + +//structure for linked list node +typedef struct node +{ + int data; + struct node* next; +}Node; + +//utility function to create a new node +Node* newNode(int x) +{ + Node* stackNode = (Node*) malloc(sizeof(Node)); + stackNode->data = x; + stackNode->next = NULL; + return stackNode; +} + +//utility function to check if linked list is empty +int isEmpty(Node* head) +{ + if(head->next==NULL) + return 1; + return 0; +} + +//utility function to push a node to linked list +void push(Node** root, int x) +{ + struct node* stackNode = newNode(x); + stackNode->next = *root; + *root = stackNode; + //use for debugging + //printf("Pushed %d to the stack\n",x); +} + +//utility function pop a node from the stack +char pop(Node** root) +{ + if(isEmpty(*root)) + return INT_MIN; + + Node* temp = *root; + *root = (*root)->next; + char popped = temp->data; + + free(temp); + return popped; +} + +//bool function to check if it's a matching pair or not +int isMatchingPair(char c1, char c2) +{ + if(c1== '(' && c2 == ')') + return 1; + else if(c1 == '[' && c2 ==']') + return 1; + else if(c1 == '{' && c2 =='}') + return 1; + else if(c1 == '<' && c2 =='>') + else + return 0; +} + +//function that checks for balanced paranthesis +int checkParathesisBalanced(char *str) +{ + int size = strlen(str); + Node* stack = NULL; + int i=0; + + while (str[i]) + { + if(str[i]=='[' || str[i]=='(' || str[i]=='{' || str[i]=='<') + { + push(&stack,(int)str[i]); + } + + if(str[i]=='}' || str[i]==')' || str[i]==']' || str[i]=='>') + { + if (stack==NULL) + return 0; + + else if (!isMatchingPair(2pop(&stack),str[i])) + return 0; + } + i++; + } + + if (stack==NULL) + return 1; + else + return 0; +} + +//utility function to safely get string input from user +static int getLine (char *prmpt, char *buff, size_t sz) { + int ch, extra; + + // Get line with buffer overrun protection. + if (prmpt != NULL) { + printf ("%s", prmpt); + fflush (stdout); + } + if (fgets (buff, sz, stdin) == NULL) + return NO_INPUT; + + // If it was too long, there'll be no newline. In that case, we flush + // to end of line so that excess doesn't affect the next call. + if (buff[strlen(buff)-1] != '\n') { + extra = 0; + while (((ch = getchar()) != '\n') && (ch != EOF)) + extra = 1; + return (extra == 1) ? TOO_LONG : OK; + } + + // Otherwise remove newline and give string back to caller. + buff[strlen(buff)-1] = '\0'; + return OK; +} + +//Drive program. Takes a string 'buff' +//from the user and checks for balanced paranthesis +int main(void) +{ + int out; + char buff[10000]; + + out = getLine ("Enter string> ", buff, sizeof(buff)); + if (out == NO_INPUT) { + // Extra NL since my system doesn't output that on EOF. + printf ("\nNo input\n"); + return 1; + } + + if (out == TOO_LONG) { + printf ("Input too long [%s]\n", buff); + return 1; + } + + printf ("OK [%s]\n", buff); + + if (checkParathesisBalanced(buff)) + printf("\n True"); + else + printf("\n False "); + + return 0; +} \ No newline at end of file From 146f4700d795cddd17806a302102144f0ddfe824 Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Tue, 10 Jan 2017 08:13:42 -0600 Subject: [PATCH 11/95] Deleted challenge 10 from master --- challenge_10/C/karanchawla/README.md | 10 -- challenge_10/C/karanchawla/challenge10.c | 172 ----------------------- 2 files changed, 182 deletions(-) delete mode 100644 challenge_10/C/karanchawla/README.md delete mode 100644 challenge_10/C/karanchawla/challenge10.c diff --git a/challenge_10/C/karanchawla/README.md b/challenge_10/C/karanchawla/README.md deleted file mode 100644 index 2f3ce0769..000000000 --- a/challenge_10/C/karanchawla/README.md +++ /dev/null @@ -1,10 +0,0 @@ -''' -Karan Chawla -Challenge #10 -''' - -This was an easy one. I used a stack to push the first ocurrences of open paranthesis and when a -closing paranthesis is encountered - popped an element from the stack and compared it to the -current element. If they "match"(for eg: '(' with ')') for every occurence - the program returns -True else returns False. - diff --git a/challenge_10/C/karanchawla/challenge10.c b/challenge_10/C/karanchawla/challenge10.c deleted file mode 100644 index d057006e0..000000000 --- a/challenge_10/C/karanchawla/challenge10.c +++ /dev/null @@ -1,172 +0,0 @@ -/* -karanchawla -Challenge #10 -Check for balanced paranthesis -Using stack to check if the matching pair exists or not -*/ - -#include -#include -#include -#include - -#ifndef OK -#define OK 0 -#endif - -#ifndef NO_INPUT -#define NO_INPUT 1 -#endif - -#ifndef TOO_LONG -#define TOO_LONG 2 -#endif - - -//structure for linked list node -typedef struct node -{ - int data; - struct node* next; -}Node; - -//utility function to create a new node -Node* newNode(int x) -{ - Node* stackNode = (Node*) malloc(sizeof(Node)); - stackNode->data = x; - stackNode->next = NULL; - return stackNode; -} - -//utility function to check if linked list is empty -int isEmpty(Node* head) -{ - if(head->next==NULL) - return 1; - return 0; -} - -//utility function to push a node to linked list -void push(Node** root, int x) -{ - struct node* stackNode = newNode(x); - stackNode->next = *root; - *root = stackNode; - //use for debugging - //printf("Pushed %d to the stack\n",x); -} - -//utility function pop a node from the stack -char pop(Node** root) -{ - if(isEmpty(*root)) - return INT_MIN; - - Node* temp = *root; - *root = (*root)->next; - char popped = temp->data; - - free(temp); - return popped; -} - -//bool function to check if it's a matching pair or not -int isMatchingPair(char c1, char c2) -{ - if(c1== '(' && c2 == ')') - return 1; - else if(c1 == '[' && c2 ==']') - return 1; - else if(c1 == '{' && c2 =='}') - return 1; - else if(c1 == '<' && c2 =='>') - else - return 0; -} - -//function that checks for balanced paranthesis -int checkParathesisBalanced(char *str) -{ - int size = strlen(str); - Node* stack = NULL; - int i=0; - - while (str[i]) - { - if(str[i]=='[' || str[i]=='(' || str[i]=='{' || str[i]=='<') - { - push(&stack,(int)str[i]); - } - - if(str[i]=='}' || str[i]==')' || str[i]==']' || str[i]=='>') - { - if (stack==NULL) - return 0; - - else if (!isMatchingPair(2pop(&stack),str[i])) - return 0; - } - i++; - } - - if (stack==NULL) - return 1; - else - return 0; -} - -//utility function to safely get string input from user -static int getLine (char *prmpt, char *buff, size_t sz) { - int ch, extra; - - // Get line with buffer overrun protection. - if (prmpt != NULL) { - printf ("%s", prmpt); - fflush (stdout); - } - if (fgets (buff, sz, stdin) == NULL) - return NO_INPUT; - - // If it was too long, there'll be no newline. In that case, we flush - // to end of line so that excess doesn't affect the next call. - if (buff[strlen(buff)-1] != '\n') { - extra = 0; - while (((ch = getchar()) != '\n') && (ch != EOF)) - extra = 1; - return (extra == 1) ? TOO_LONG : OK; - } - - // Otherwise remove newline and give string back to caller. - buff[strlen(buff)-1] = '\0'; - return OK; -} - -//Drive program. Takes a string 'buff' -//from the user and checks for balanced paranthesis -int main(void) -{ - int out; - char buff[10000]; - - out = getLine ("Enter string> ", buff, sizeof(buff)); - if (out == NO_INPUT) { - // Extra NL since my system doesn't output that on EOF. - printf ("\nNo input\n"); - return 1; - } - - if (out == TOO_LONG) { - printf ("Input too long [%s]\n", buff); - return 1; - } - - printf ("OK [%s]\n", buff); - - if (checkParathesisBalanced(buff)) - printf("\n True"); - else - printf("\n False "); - - return 0; -} \ No newline at end of file From 9b53c21b4390de8b25919f2af713a15293859685 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Tue, 10 Jan 2017 09:32:23 -0700 Subject: [PATCH 12/95] Rename challenge_5/C/karanchawla/src/README.md to challenge_5/c/karanchawla/README.md --- challenge_5/{C/karanchawla/src => c/karanchawla}/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename challenge_5/{C/karanchawla/src => c/karanchawla}/README.md (90%) diff --git a/challenge_5/C/karanchawla/src/README.md b/challenge_5/c/karanchawla/README.md similarity index 90% rename from challenge_5/C/karanchawla/src/README.md rename to challenge_5/c/karanchawla/README.md index 1fa8473ca..b3d9ca532 100644 --- a/challenge_5/C/karanchawla/src/README.md +++ b/challenge_5/c/karanchawla/README.md @@ -10,4 +10,4 @@ Add a character to this shuffled string. Sort the two strings and compare to return the added character. To Do: -[ ] Change the random position based implementation to account for the edge case when length(s) = 0 \ No newline at end of file +[ ] Change the random position based implementation to account for the edge case when length(s) = 0 From c49ff957ab065c32faf80d647d37165bacabb396 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Tue, 10 Jan 2017 09:32:43 -0700 Subject: [PATCH 13/95] Rename challenge_8/C/README.md to challenge_8/c/karanchawla/README.md --- challenge_8/{C => c/karanchawla}/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename challenge_8/{C => c/karanchawla}/README.md (88%) diff --git a/challenge_8/C/README.md b/challenge_8/c/karanchawla/README.md similarity index 88% rename from challenge_8/C/README.md rename to challenge_8/c/karanchawla/README.md index d0f990a65..cb6e24b49 100644 --- a/challenge_8/C/README.md +++ b/challenge_8/c/karanchawla/README.md @@ -8,4 +8,4 @@ Okay so I took the easy way of just copying each node right after each node in the first list and copying the random node data to the new nodes. Once this is achieved, separate the two lists. (Phew finally no Seg faults) -*Includes an example with 5 nodes.* \ No newline at end of file +*Includes an example with 5 nodes.* From d8398fe55365c68e252524b2223c4c04f7681aa7 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Tue, 10 Jan 2017 09:33:05 -0700 Subject: [PATCH 14/95] Rename challenge_8/C/randomDeepCopy.c to challenge_8/c/karanchawla/randomDeepCopy.c --- challenge_8/{C => c/karanchawla}/randomDeepCopy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename challenge_8/{C => c/karanchawla}/randomDeepCopy.c (99%) diff --git a/challenge_8/C/randomDeepCopy.c b/challenge_8/c/karanchawla/randomDeepCopy.c similarity index 99% rename from challenge_8/C/randomDeepCopy.c rename to challenge_8/c/karanchawla/randomDeepCopy.c index a4da2372a..454ed0eb3 100644 --- a/challenge_8/C/randomDeepCopy.c +++ b/challenge_8/c/karanchawla/randomDeepCopy.c @@ -121,4 +121,4 @@ int main(void) printList(deepCopyList); return 0; -} \ No newline at end of file +} From 814fe3801c458ef2868376d7826bed84cdf6f923 Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Tue, 10 Jan 2017 09:33:32 -0700 Subject: [PATCH 15/95] Rename challenge_5/C/karanchawla/src/challenge5.c to challenge_5/c/karanchawla/src/challenge5.c --- challenge_5/{C => c}/karanchawla/src/challenge5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename challenge_5/{C => c}/karanchawla/src/challenge5.c (99%) diff --git a/challenge_5/C/karanchawla/src/challenge5.c b/challenge_5/c/karanchawla/src/challenge5.c similarity index 99% rename from challenge_5/C/karanchawla/src/challenge5.c rename to challenge_5/c/karanchawla/src/challenge5.c index 9ab467a76..de1ca788a 100644 --- a/challenge_5/C/karanchawla/src/challenge5.c +++ b/challenge_5/c/karanchawla/src/challenge5.c @@ -117,4 +117,4 @@ int main(void) } return 0; -} \ No newline at end of file +} From d81c93bc033e6a102ad6cc116a28475473fc6d2a Mon Sep 17 00:00:00 2001 From: whiterd Date: Tue, 10 Jan 2017 21:53:45 -0600 Subject: [PATCH 16/95] [Python] Challenge 4 (Unreviewed) --- challenge_4/python/whiterd/README.md | 7 +++++++ challenge_4/python/whiterd/src/invert_bin.py | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 challenge_4/python/whiterd/README.md create mode 100644 challenge_4/python/whiterd/src/invert_bin.py diff --git a/challenge_4/python/whiterd/README.md b/challenge_4/python/whiterd/README.md new file mode 100644 index 000000000..90a661a0e --- /dev/null +++ b/challenge_4/python/whiterd/README.md @@ -0,0 +1,7 @@ +# Invert Binary Tree + +* Take in a binary tree as a nested list. + +* For each level in the tree, reverse the order of the items in that level. + +* Output the resulting binary tree. \ No newline at end of file diff --git a/challenge_4/python/whiterd/src/invert_bin.py b/challenge_4/python/whiterd/src/invert_bin.py new file mode 100644 index 000000000..96cee1a5e --- /dev/null +++ b/challenge_4/python/whiterd/src/invert_bin.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +''' + Input: An object consisting of a binary tree. + + Output: The same tree with values mirrored. +''' + +def mirror(node): + if node: + mirror(node.left) + mirror(node.right) + node.left, node.right = node.right, node.left From b313c05d95171544c7cea3ee6b2026df5a412b89 Mon Sep 17 00:00:00 2001 From: Sarcodian Date: Wed, 11 Jan 2017 15:55:44 +0300 Subject: [PATCH 17/95] challenge 1 in python --- challenge_1/python/sarcodian/README.md | 1 + challenge_1/python/sarcodian/src/challenge_1.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 challenge_1/python/sarcodian/README.md create mode 100644 challenge_1/python/sarcodian/src/challenge_1.py diff --git a/challenge_1/python/sarcodian/README.md b/challenge_1/python/sarcodian/README.md new file mode 100644 index 000000000..7cf13b107 --- /dev/null +++ b/challenge_1/python/sarcodian/README.md @@ -0,0 +1 @@ +Reversing a string \ No newline at end of file diff --git a/challenge_1/python/sarcodian/src/challenge_1.py b/challenge_1/python/sarcodian/src/challenge_1.py new file mode 100644 index 000000000..f90ff4cfb --- /dev/null +++ b/challenge_1/python/sarcodian/src/challenge_1.py @@ -0,0 +1,4 @@ +def reverse(): + s = input('Please enter a string: ') + h = s[::-1] + return h \ No newline at end of file From 0d230efb9805db289ae30b6d1b6e96c1eca51ba6 Mon Sep 17 00:00:00 2001 From: Sarcodian Date: Wed, 11 Jan 2017 15:57:48 +0300 Subject: [PATCH 18/95] challenge 0 in python --- challenge_0/python/sarcodian/src/challenge_0.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge_0/python/sarcodian/src/challenge_0.py diff --git a/challenge_0/python/sarcodian/src/challenge_0.py b/challenge_0/python/sarcodian/src/challenge_0.py new file mode 100644 index 000000000..d3e46f27c --- /dev/null +++ b/challenge_0/python/sarcodian/src/challenge_0.py @@ -0,0 +1 @@ +print('Hello World') \ No newline at end of file From e2ecb32e452331f1b459ca86fee89556e498ccba Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Wed, 11 Jan 2017 09:19:32 -0500 Subject: [PATCH 19/95] The script now activates reverse immediately --- challenge_1/python/sarcodian/src/challenge_1.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/challenge_1/python/sarcodian/src/challenge_1.py b/challenge_1/python/sarcodian/src/challenge_1.py index f90ff4cfb..142b783e6 100644 --- a/challenge_1/python/sarcodian/src/challenge_1.py +++ b/challenge_1/python/sarcodian/src/challenge_1.py @@ -1,4 +1,6 @@ def reverse(): s = input('Please enter a string: ') h = s[::-1] - return h \ No newline at end of file + return h + +reverse() From c11515ba70832d3b2f0ea18e7c808caa1efe4f44 Mon Sep 17 00:00:00 2001 From: whiterd Date: Wed, 11 Jan 2017 08:49:03 -0600 Subject: [PATCH 20/95] [Python] Challenge 4 (Unreviewed) --- challenge_4/python/whiterd/README.md | 6 +++--- challenge_4/python/whiterd/src/invert_bin.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/challenge_4/python/whiterd/README.md b/challenge_4/python/whiterd/README.md index 90a661a0e..da7eb3581 100644 --- a/challenge_4/python/whiterd/README.md +++ b/challenge_4/python/whiterd/README.md @@ -1,7 +1,7 @@ # Invert Binary Tree -* Take in a binary tree as a nested list. +* Take in a binary tree object. -* For each level in the tree, reverse the order of the items in that level. +* For each level in the tree, reverse the order of the items in that level (mirror). -* Output the resulting binary tree. \ No newline at end of file +* Return the node object. \ No newline at end of file diff --git a/challenge_4/python/whiterd/src/invert_bin.py b/challenge_4/python/whiterd/src/invert_bin.py index 96cee1a5e..194128418 100644 --- a/challenge_4/python/whiterd/src/invert_bin.py +++ b/challenge_4/python/whiterd/src/invert_bin.py @@ -11,3 +11,5 @@ def mirror(node): mirror(node.left) mirror(node.right) node.left, node.right = node.right, node.left + + return node From 7c52fbfdcf69fadfe671c397a14a550883912a8c Mon Sep 17 00:00:00 2001 From: Alexander Payne Date: Wed, 11 Jan 2017 08:33:13 -0700 Subject: [PATCH 21/95] Solve Challenge #3 in Rust (#327) --- challenge_3/rust/myrrlyn/Cargo.lock | 4 ++ challenge_3/rust/myrrlyn/Cargo.toml | 6 +++ challenge_3/rust/myrrlyn/README.md | 29 +++++++++++++ challenge_3/rust/myrrlyn/src/lib.rs | 61 ++++++++++++++++++++++++++++ challenge_3/rust/myrrlyn/src/main.rs | 29 +++++++++++++ 5 files changed, 129 insertions(+) create mode 100644 challenge_3/rust/myrrlyn/Cargo.lock create mode 100644 challenge_3/rust/myrrlyn/Cargo.toml create mode 100644 challenge_3/rust/myrrlyn/README.md create mode 100644 challenge_3/rust/myrrlyn/src/lib.rs create mode 100644 challenge_3/rust/myrrlyn/src/main.rs diff --git a/challenge_3/rust/myrrlyn/Cargo.lock b/challenge_3/rust/myrrlyn/Cargo.lock new file mode 100644 index 000000000..9869d34d1 --- /dev/null +++ b/challenge_3/rust/myrrlyn/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "myrrlyn" +version = "0.1.0" + diff --git a/challenge_3/rust/myrrlyn/Cargo.toml b/challenge_3/rust/myrrlyn/Cargo.toml new file mode 100644 index 000000000..61e7f8aa8 --- /dev/null +++ b/challenge_3/rust/myrrlyn/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "myrrlyn" +version = "0.1.0" +authors = ["myrrlyn "] + +[dependencies] diff --git a/challenge_3/rust/myrrlyn/README.md b/challenge_3/rust/myrrlyn/README.md new file mode 100644 index 000000000..1af514e22 --- /dev/null +++ b/challenge_3/rust/myrrlyn/README.md @@ -0,0 +1,29 @@ +# Challenge 3 + +This solution uses the exact same overally structure as my Challenge 2 solution. +A function consumes a vector of some type (I splurged and set it to be generic +over any type that implements `Display`, `Eq`, and `Hash`) and emits a result. + +In this case, the function returns something or nothing. Coincidentally, these +are the exact discriminants that compose `Option`, so the function returns +an `Option<(T, i32, usize>)` where `T` is the type being scanned. The tuple is +composed of the member of `T` with majority occurrence in the set, the `i32` +count of occurrences, and the `usize` count of total elements in the set. + +The library function is consumed by the main executable, which matches on the +result. For `Some(result)`, it prints the element, count, and total; for `None`, +it sadly informs us that no majority element occurs. + +This also requires nightly Rust. + +## Usage + +1. [Install Rustup][https://rustup.rs] if you have not yet done so. +1. Do `rustup toolchain install nightly` if you have not yet done so. +1. Do `cd challenge_3/rust/myrrlyn; rustup override set nightly`. +1. Do `cargo test` to see tests pass. +1. Do `echo "1 2 2 3 3 3 3" | cargo run` to see it work on your input. +1. Do `echo "1 2 3 3" | cargo run` to see it not work on your input. +1. Do `cargo run` to have it await your input. You'll need to hit enter, then + ctrl-D, to close standard input. I collect ALL input, rather than looping + over lines. I may want to change that in the future. diff --git a/challenge_3/rust/myrrlyn/src/lib.rs b/challenge_3/rust/myrrlyn/src/lib.rs new file mode 100644 index 000000000..8cecaed5b --- /dev/null +++ b/challenge_3/rust/myrrlyn/src/lib.rs @@ -0,0 +1,61 @@ +use std::cmp::Eq; +use std::collections::HashMap; +use std::fmt::Display; +use std::hash::Hash; + +/// Find the majority element in a collection, if there is one. +/// +/// Generic over any type which can be displayed, equated, and hashed. +pub fn find_majority(data: Vec) -> Option<(T, i32, usize)> { + let mut counter = HashMap::new(); + + let len = data.len(); + + for elem in data { + let entry = counter.entry(elem).or_insert(0); + *entry += 1; + } + + // Find the key and value that are the majority element. + let (mk, mv) = counter + // Consume the collection + .drain() + // And collapse it into a single value + .fold((None, 0), |acc, elem| { + // If the current element occurs more often than the accumulator, + // keep this instead + if elem.1 > acc.1 { + (Some(elem.0), elem.1) + } + // Otherwise hold on to the accumulator + else { + acc + } + }); + + // If the collapsed max value is more than half, return a success + if mv as f32 > len as f32 / 2.0 { + Some((mk.unwrap(), mv, len)) + } + // If the collapsed max value fails to reach majority, return a failure + else { + None + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn find_most() { + let maj = find_majority(vec![1, 2, 2, 3, 3, 3, 3,]); + assert_eq!(Some((3, 4, 7)), maj); + } + + #[test] + fn fail_find() { + let maj = find_majority(vec![1, 2, 3]); + assert_eq!(None, maj); + } +} diff --git a/challenge_3/rust/myrrlyn/src/main.rs b/challenge_3/rust/myrrlyn/src/main.rs new file mode 100644 index 000000000..d6f9a65cd --- /dev/null +++ b/challenge_3/rust/myrrlyn/src/main.rs @@ -0,0 +1,29 @@ +#![feature(io)] + +extern crate myrrlyn; + +use myrrlyn::*; + +use std::io::{ + Read, + stdin, +}; + +fn main() { + let inbuf: Vec = stdin() + .chars() + .map(|x| x.unwrap()) + .filter(|&x| !x.is_whitespace()) + .collect(); + + let outbuf = find_majority(inbuf); + + match outbuf { + Some((k, v, l)) => { + println!("The majority element, {}, occurred {} times out of {}", k, v, l); + }, + _ => { + println!("No majority element could be found."); + } + } +} From 7ced97915c40e7e997bb8b6082b16412f030253b Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Wed, 11 Jan 2017 09:37:02 -0600 Subject: [PATCH 22/95] [C] Challenge 4 (#368) * Deleted stuff * [C] Challenge 4 (Unreviewed) * Update challenge_4.c --- challenge_4/c/karanchawla/README.md | 6 ++ challenge_4/c/karanchawla/challenge_4.c | 74 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 challenge_4/c/karanchawla/README.md create mode 100644 challenge_4/c/karanchawla/challenge_4.c diff --git a/challenge_4/c/karanchawla/README.md b/challenge_4/c/karanchawla/README.md new file mode 100644 index 000000000..c78d622cf --- /dev/null +++ b/challenge_4/c/karanchawla/README.md @@ -0,0 +1,6 @@ +``` +Karan Chawla +Challenge 4 +``` +This was an easy question where I just recursively called the left and the right nodes to switch the pointers. Rest of the work was done in writing the utility +functions for the tree. \ No newline at end of file diff --git a/challenge_4/c/karanchawla/challenge_4.c b/challenge_4/c/karanchawla/challenge_4.c new file mode 100644 index 000000000..c7abcffb7 --- /dev/null +++ b/challenge_4/c/karanchawla/challenge_4.c @@ -0,0 +1,74 @@ +#include +#include + +//Define node +typedef struct node +{ + /* data */ + int data; + struct node* left, *right; +}Node; + +//utility function for adding a new node +Node* newNode(int data) +{ + Node* newNode = (Node*) malloc(sizeof(Node)); + newNode->left = NULL; + newNode->right = NULL; + newNode->data = data; + + return newNode; +} + +//function to invert the tree +void invertTree(Node* head) +{ + if(head==NULL) + { + return; + } + else + { + Node* temp = head; + invertTree(head->left); + invertTree(head->right); + + temp = head->left; + head->left = head->right; + head->right = temp; + } + + return; +} + +//utility function for inorder tree traversal +void inOrder(struct node* node) +{ + if (node == NULL) + return; + + inOrder(node->left); + printf("%d ", node->data); + inOrder(node->right); +} + +//Driver function +int main(void) +{ + struct node *root = newNode(4); + root->left = newNode(2); + root->right = newNode(7); + root->left->left = newNode(6); + root->left->right = newNode(9); + root->right->left = newNode(1); + root->right->right = newNode(3); + + inOrder(root); + + printf("\n"); + + invertTree(root); + + inOrder(root); + return 0; +} From 9e907b541647ef7368460f2d53ddcd3d85fadae1 Mon Sep 17 00:00:00 2001 From: joegotflow83 Date: Wed, 11 Jan 2017 10:38:54 -0500 Subject: [PATCH 23/95] Elixir Challenge 2, 3, and 5 (#335) * Completed challenge 0 and 1 * Completed Challenge 2, 3, and 5 --- .../joegotflow83/single_number/.gitignore | 17 ++++++++++ .../joegotflow83/single_number/README.md | 24 ++++++++++++++ .../single_number/config/config.exs | 30 +++++++++++++++++ .../single_number/lib/single_number.ex | 25 +++++++++++++++ .../elixir/joegotflow83/single_number/mix.exs | 32 +++++++++++++++++++ .../single_number/test/single_number_test.exs | 24 ++++++++++++++ .../single_number/test/test_helper.exs | 1 + .../joegotflow83/majority_element/.gitignore | 17 ++++++++++ .../joegotflow83/majority_element/README.md | 24 ++++++++++++++ .../majority_element/config/config.exs | 30 +++++++++++++++++ .../majority_element/lib/majority_element.ex | 26 +++++++++++++++ .../joegotflow83/majority_element/mix.exs | 32 +++++++++++++++++++ .../test/majority_element_test.exs | 12 +++++++ .../majority_element/test/test_helper.exs | 1 + .../joegotflow83/find_difference/.gitignore | 17 ++++++++++ .../joegotflow83/find_difference/README.md | 24 ++++++++++++++ .../find_difference/config/config.exs | 30 +++++++++++++++++ .../find_difference/lib/find_difference.ex | 29 +++++++++++++++++ .../joegotflow83/find_difference/mix.exs | 32 +++++++++++++++++++ .../test/find_difference_test.exs | 20 ++++++++++++ .../find_difference/test/test_helper.exs | 1 + 21 files changed, 448 insertions(+) create mode 100644 challenge_2/elixir/joegotflow83/single_number/.gitignore create mode 100644 challenge_2/elixir/joegotflow83/single_number/README.md create mode 100644 challenge_2/elixir/joegotflow83/single_number/config/config.exs create mode 100644 challenge_2/elixir/joegotflow83/single_number/lib/single_number.ex create mode 100644 challenge_2/elixir/joegotflow83/single_number/mix.exs create mode 100644 challenge_2/elixir/joegotflow83/single_number/test/single_number_test.exs create mode 100644 challenge_2/elixir/joegotflow83/single_number/test/test_helper.exs create mode 100644 challenge_3/elixir/joegotflow83/majority_element/.gitignore create mode 100644 challenge_3/elixir/joegotflow83/majority_element/README.md create mode 100644 challenge_3/elixir/joegotflow83/majority_element/config/config.exs create mode 100644 challenge_3/elixir/joegotflow83/majority_element/lib/majority_element.ex create mode 100644 challenge_3/elixir/joegotflow83/majority_element/mix.exs create mode 100644 challenge_3/elixir/joegotflow83/majority_element/test/majority_element_test.exs create mode 100644 challenge_3/elixir/joegotflow83/majority_element/test/test_helper.exs create mode 100644 challenge_5/elixir/joegotflow83/find_difference/.gitignore create mode 100644 challenge_5/elixir/joegotflow83/find_difference/README.md create mode 100644 challenge_5/elixir/joegotflow83/find_difference/config/config.exs create mode 100644 challenge_5/elixir/joegotflow83/find_difference/lib/find_difference.ex create mode 100644 challenge_5/elixir/joegotflow83/find_difference/mix.exs create mode 100644 challenge_5/elixir/joegotflow83/find_difference/test/find_difference_test.exs create mode 100644 challenge_5/elixir/joegotflow83/find_difference/test/test_helper.exs diff --git a/challenge_2/elixir/joegotflow83/single_number/.gitignore b/challenge_2/elixir/joegotflow83/single_number/.gitignore new file mode 100644 index 000000000..6e1db0f16 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/.gitignore @@ -0,0 +1,17 @@ +# The directory Mix will write compiled artifacts to. +/_build + +# If you run "mix test --cover", coverage assets end up here. +/cover + +# The directory Mix downloads your dependencies sources to. +/deps + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez diff --git a/challenge_2/elixir/joegotflow83/single_number/README.md b/challenge_2/elixir/joegotflow83/single_number/README.md new file mode 100644 index 000000000..676887e65 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/README.md @@ -0,0 +1,24 @@ +# SingleNumber + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed as: + + 1. Add `single_number` to your list of dependencies in `mix.exs`: + + ```elixir + def deps do + [{:single_number, "~> 0.1.0"}] + end + ``` + + 2. Ensure `single_number` is started before your application: + + ```elixir + def application do + [applications: [:single_number]] + end + ``` + diff --git a/challenge_2/elixir/joegotflow83/single_number/config/config.exs b/challenge_2/elixir/joegotflow83/single_number/config/config.exs new file mode 100644 index 000000000..c59c61c12 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/config/config.exs @@ -0,0 +1,30 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +# This configuration is loaded before any dependency and is restricted +# to this project. If another project depends on this project, this +# file won't be loaded nor affect the parent project. For this reason, +# if you want to provide default values for your application for +# 3rd-party users, it should be done in your "mix.exs" file. + +# You can configure for your application as: +# +# config :single_number, key: :value +# +# And access this configuration in your application as: +# +# Application.get_env(:single_number, :key) +# +# Or configure a 3rd-party app: +# +# config :logger, level: :info +# + +# It is also possible to import configuration files, relative to this +# directory. For example, you can emulate configuration per environment +# by uncommenting the line below and defining dev.exs, test.exs and such. +# Configuration from the imported file will override the ones defined +# here (which is why it is important to import them last). +# +# import_config "#{Mix.env}.exs" diff --git a/challenge_2/elixir/joegotflow83/single_number/lib/single_number.ex b/challenge_2/elixir/joegotflow83/single_number/lib/single_number.ex new file mode 100644 index 000000000..c148279b4 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/lib/single_number.ex @@ -0,0 +1,25 @@ +defmodule SingleNumber do + def unique(input) do + input + |> Enum.reduce(%{}, &count/2) + |> Map.to_list + |> find_uni + end + + def find_uni([head | tail]) do + case head do + {num, 1} -> + num + _ -> + find_uni(tail) + end + end + + def find_uni([]) do + "There are no unique elements." + end + + def count(num, acc) do + Map.update acc, num, 1, &(&1 + 1) + end +end diff --git a/challenge_2/elixir/joegotflow83/single_number/mix.exs b/challenge_2/elixir/joegotflow83/single_number/mix.exs new file mode 100644 index 000000000..35dc955c6 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/mix.exs @@ -0,0 +1,32 @@ +defmodule SingleNumber.Mixfile do + use Mix.Project + + def project do + [app: :single_number, + version: "0.1.0", + elixir: "~> 1.3", + build_embedded: Mix.env == :prod, + start_permanent: Mix.env == :prod, + deps: deps()] + end + + # Configuration for the OTP application + # + # Type "mix help compile.app" for more information + def application do + [applications: [:logger]] + end + + # Dependencies can be Hex packages: + # + # {:mydep, "~> 0.3.0"} + # + # Or git/path repositories: + # + # {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"} + # + # Type "mix help deps" for more examples and options + defp deps do + [] + end +end diff --git a/challenge_2/elixir/joegotflow83/single_number/test/single_number_test.exs b/challenge_2/elixir/joegotflow83/single_number/test/single_number_test.exs new file mode 100644 index 000000000..b86bcd9e9 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/test/single_number_test.exs @@ -0,0 +1,24 @@ +defmodule SingleNumberTest do + use ExUnit.Case + doctest SingleNumber + + test "first value is non repeating" do + assert 1 == SingleNumber.unique([1, 2, 2, 3, 5, 5, 3, 6, 6]) + end + + test "middle value is non repeating" do + assert 4 == SingleNumber.unique([9, 8, 9, 4, 5, 7, 5, 7, 8]) + end + + test "last value is non repeating" do + assert 9 == SingleNumber.unique([10, 5, 3, 5, 3, 10, 9]) + end + + test "characters work as well" do + assert "a" == SingleNumber.unique(["b", "b", 7, 9, "a", 9, 7]) + end + + test "if no unique elements exist" do + assert "There are no unique elements." == SingleNumber.unique([1, 2, 3, 3, 2, 1]) + end +end diff --git a/challenge_2/elixir/joegotflow83/single_number/test/test_helper.exs b/challenge_2/elixir/joegotflow83/single_number/test/test_helper.exs new file mode 100644 index 000000000..869559e70 --- /dev/null +++ b/challenge_2/elixir/joegotflow83/single_number/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start() diff --git a/challenge_3/elixir/joegotflow83/majority_element/.gitignore b/challenge_3/elixir/joegotflow83/majority_element/.gitignore new file mode 100644 index 000000000..6e1db0f16 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/.gitignore @@ -0,0 +1,17 @@ +# The directory Mix will write compiled artifacts to. +/_build + +# If you run "mix test --cover", coverage assets end up here. +/cover + +# The directory Mix downloads your dependencies sources to. +/deps + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez diff --git a/challenge_3/elixir/joegotflow83/majority_element/README.md b/challenge_3/elixir/joegotflow83/majority_element/README.md new file mode 100644 index 000000000..5180c0f97 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/README.md @@ -0,0 +1,24 @@ +# MajorityElement + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed as: + + 1. Add `majority_element` to your list of dependencies in `mix.exs`: + + ```elixir + def deps do + [{:majority_element, "~> 0.1.0"}] + end + ``` + + 2. Ensure `majority_element` is started before your application: + + ```elixir + def application do + [applications: [:majority_element]] + end + ``` + diff --git a/challenge_3/elixir/joegotflow83/majority_element/config/config.exs b/challenge_3/elixir/joegotflow83/majority_element/config/config.exs new file mode 100644 index 000000000..828be4ab0 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/config/config.exs @@ -0,0 +1,30 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +# This configuration is loaded before any dependency and is restricted +# to this project. If another project depends on this project, this +# file won't be loaded nor affect the parent project. For this reason, +# if you want to provide default values for your application for +# 3rd-party users, it should be done in your "mix.exs" file. + +# You can configure for your application as: +# +# config :majority_element, key: :value +# +# And access this configuration in your application as: +# +# Application.get_env(:majority_element, :key) +# +# Or configure a 3rd-party app: +# +# config :logger, level: :info +# + +# It is also possible to import configuration files, relative to this +# directory. For example, you can emulate configuration per environment +# by uncommenting the line below and defining dev.exs, test.exs and such. +# Configuration from the imported file will override the ones defined +# here (which is why it is important to import them last). +# +# import_config "#{Mix.env}.exs" diff --git a/challenge_3/elixir/joegotflow83/majority_element/lib/majority_element.ex b/challenge_3/elixir/joegotflow83/majority_element/lib/majority_element.ex new file mode 100644 index 000000000..810b90242 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/lib/majority_element.ex @@ -0,0 +1,26 @@ +defmodule MajorityElement do + def find_major_ele(input) when is_list(input) do + input + |> Enum.reduce(%{}, &count/2) + |> Map.to_list + |> determine_majority(length(input)) + end + + def determine_majority([head | tail], n) do + {num, value} = head + cond do + value > (n / 2) -> + num + true -> + determine_majority(tail, n) + end + end + + def determine_majority([], _n) do + "No element is the majority." + end + + def count(num, acc) do + Map.update acc, num, 1, &(&1 + 1) + end +end diff --git a/challenge_3/elixir/joegotflow83/majority_element/mix.exs b/challenge_3/elixir/joegotflow83/majority_element/mix.exs new file mode 100644 index 000000000..250ca9953 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/mix.exs @@ -0,0 +1,32 @@ +defmodule MajorityElement.Mixfile do + use Mix.Project + + def project do + [app: :majority_element, + version: "0.1.0", + elixir: "~> 1.3", + build_embedded: Mix.env == :prod, + start_permanent: Mix.env == :prod, + deps: deps()] + end + + # Configuration for the OTP application + # + # Type "mix help compile.app" for more information + def application do + [applications: [:logger]] + end + + # Dependencies can be Hex packages: + # + # {:mydep, "~> 0.3.0"} + # + # Or git/path repositories: + # + # {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"} + # + # Type "mix help deps" for more examples and options + defp deps do + [] + end +end diff --git a/challenge_3/elixir/joegotflow83/majority_element/test/majority_element_test.exs b/challenge_3/elixir/joegotflow83/majority_element/test/majority_element_test.exs new file mode 100644 index 000000000..d23dcedf9 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/test/majority_element_test.exs @@ -0,0 +1,12 @@ +defmodule MajorityElementTest do + use ExUnit.Case + doctest MajorityElement + + test "test major element is present" do + assert 7 == MajorityElement.find_major_ele([2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7]) + end + + test "test no major element is present" do + assert "No element is the majority." == MajorityElement.find_major_ele([2,2,2,1,2,2,4,5,6,7,8,9,7,5,3]) + end +end diff --git a/challenge_3/elixir/joegotflow83/majority_element/test/test_helper.exs b/challenge_3/elixir/joegotflow83/majority_element/test/test_helper.exs new file mode 100644 index 000000000..869559e70 --- /dev/null +++ b/challenge_3/elixir/joegotflow83/majority_element/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start() diff --git a/challenge_5/elixir/joegotflow83/find_difference/.gitignore b/challenge_5/elixir/joegotflow83/find_difference/.gitignore new file mode 100644 index 000000000..6e1db0f16 --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/.gitignore @@ -0,0 +1,17 @@ +# The directory Mix will write compiled artifacts to. +/_build + +# If you run "mix test --cover", coverage assets end up here. +/cover + +# The directory Mix downloads your dependencies sources to. +/deps + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez diff --git a/challenge_5/elixir/joegotflow83/find_difference/README.md b/challenge_5/elixir/joegotflow83/find_difference/README.md new file mode 100644 index 000000000..9a43529ca --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/README.md @@ -0,0 +1,24 @@ +# FindDifference + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed as: + + 1. Add `find_difference` to your list of dependencies in `mix.exs`: + + ```elixir + def deps do + [{:find_difference, "~> 0.1.0"}] + end + ``` + + 2. Ensure `find_difference` is started before your application: + + ```elixir + def application do + [applications: [:find_difference]] + end + ``` + diff --git a/challenge_5/elixir/joegotflow83/find_difference/config/config.exs b/challenge_5/elixir/joegotflow83/find_difference/config/config.exs new file mode 100644 index 000000000..eb92b07be --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/config/config.exs @@ -0,0 +1,30 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +# This configuration is loaded before any dependency and is restricted +# to this project. If another project depends on this project, this +# file won't be loaded nor affect the parent project. For this reason, +# if you want to provide default values for your application for +# 3rd-party users, it should be done in your "mix.exs" file. + +# You can configure for your application as: +# +# config :find_difference, key: :value +# +# And access this configuration in your application as: +# +# Application.get_env(:find_difference, :key) +# +# Or configure a 3rd-party app: +# +# config :logger, level: :info +# + +# It is also possible to import configuration files, relative to this +# directory. For example, you can emulate configuration per environment +# by uncommenting the line below and defining dev.exs, test.exs and such. +# Configuration from the imported file will override the ones defined +# here (which is why it is important to import them last). +# +# import_config "#{Mix.env}.exs" diff --git a/challenge_5/elixir/joegotflow83/find_difference/lib/find_difference.ex b/challenge_5/elixir/joegotflow83/find_difference/lib/find_difference.ex new file mode 100644 index 000000000..59fa72d72 --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/lib/find_difference.ex @@ -0,0 +1,29 @@ +defmodule FindDifference do + def difference(string1, string2) do + string1 = string_to_list(string1) + string2 = string_to_list(string2) + cond do + length(string1) < length(string2) -> + check_char(string2, string1) + length(string1) > length(string2) -> + check_char(string1, string2) + end + end + + def check_char([head | tail], comp_string) do + case Enum.member?(comp_string, head) do + true -> + check_char(tail, comp_string) + false -> + head + end + end + + def check_char([], _comp_string) do + "The strings are identical" + end + + def string_to_list(string) do + String.graphemes(string) + end +end diff --git a/challenge_5/elixir/joegotflow83/find_difference/mix.exs b/challenge_5/elixir/joegotflow83/find_difference/mix.exs new file mode 100644 index 000000000..ee4f8f5d5 --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/mix.exs @@ -0,0 +1,32 @@ +defmodule FindDifference.Mixfile do + use Mix.Project + + def project do + [app: :find_difference, + version: "0.1.0", + elixir: "~> 1.3", + build_embedded: Mix.env == :prod, + start_permanent: Mix.env == :prod, + deps: deps()] + end + + # Configuration for the OTP application + # + # Type "mix help compile.app" for more information + def application do + [applications: [:logger]] + end + + # Dependencies can be Hex packages: + # + # {:mydep, "~> 0.3.0"} + # + # Or git/path repositories: + # + # {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"} + # + # Type "mix help deps" for more examples and options + defp deps do + [] + end +end diff --git a/challenge_5/elixir/joegotflow83/find_difference/test/find_difference_test.exs b/challenge_5/elixir/joegotflow83/find_difference/test/find_difference_test.exs new file mode 100644 index 000000000..b21fe5dd1 --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/test/find_difference_test.exs @@ -0,0 +1,20 @@ +defmodule FindDifferenceTest do + use ExUnit.Case + doctest FindDifference + + test "difference is spotted at end of line" do + assert "e" == FindDifference.difference("abcd", "abcde") + end + + test "difference is spotted at front of line" do + assert "f" == FindDifference.difference("food", "ood") + end + + test "difference is spotted at middle of line" do + assert "z" == FindDifference.difference("thzpot", "thpot") + end + + test "numbers in strings work as well" do + assert "3" == FindDifference.difference("12345", "1245") + end +end diff --git a/challenge_5/elixir/joegotflow83/find_difference/test/test_helper.exs b/challenge_5/elixir/joegotflow83/find_difference/test/test_helper.exs new file mode 100644 index 000000000..869559e70 --- /dev/null +++ b/challenge_5/elixir/joegotflow83/find_difference/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start() From c89f9b07b6e5f2478b2dd56a2644532d8d183c32 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 11 Jan 2017 16:40:04 +0100 Subject: [PATCH 24/95] [c++] [c#] Challenges 0, 1 & 2 (#304) * [C++] Challenge 0 * [C#] Challenge 0 * [C++] Challenge 1 * [C#] Challenge 1 * [C++] Challenge 2 * [C#] Challenge 2 * Update README.md * Update README.md --- challenge_0/cpp/sven/README.md | 11 ++++++++++ challenge_0/cpp/sven/src/HelloWorld.cpp | 7 ++++++ challenge_0/csharp/sven/README.md | 7 ++++++ challenge_0/csharp/sven/src/HelloWorld.cs | 12 +++++++++++ challenge_1/cpp/sven/README.md | 12 +++++++++++ challenge_1/cpp/sven/src/Reverse.cpp | 15 +++++++++++++ challenge_1/csharp/sven/README.md | 8 +++++++ challenge_1/csharp/sven/src/Reverse.cs | 15 +++++++++++++ challenge_2/cpp/sven/README.md | 12 +++++++++++ challenge_2/cpp/sven/src/Single.cpp | 22 +++++++++++++++++++ challenge_2/csharp/sven/README.md | 8 +++++++ challenge_2/csharp/sven/src/Single.cs | 26 +++++++++++++++++++++++ 12 files changed, 155 insertions(+) create mode 100644 challenge_0/cpp/sven/README.md create mode 100644 challenge_0/cpp/sven/src/HelloWorld.cpp create mode 100644 challenge_0/csharp/sven/README.md create mode 100644 challenge_0/csharp/sven/src/HelloWorld.cs create mode 100644 challenge_1/cpp/sven/README.md create mode 100644 challenge_1/cpp/sven/src/Reverse.cpp create mode 100644 challenge_1/csharp/sven/README.md create mode 100644 challenge_1/csharp/sven/src/Reverse.cs create mode 100644 challenge_2/cpp/sven/README.md create mode 100644 challenge_2/cpp/sven/src/Single.cpp create mode 100644 challenge_2/csharp/sven/README.md create mode 100644 challenge_2/csharp/sven/src/Single.cs diff --git a/challenge_0/cpp/sven/README.md b/challenge_0/cpp/sven/README.md new file mode 100644 index 000000000..1f609918f --- /dev/null +++ b/challenge_0/cpp/sven/README.md @@ -0,0 +1,11 @@ +#Challenge_0 Solution + +Under Windows - using the Visual studio c++ compiler: +run "cl.exe src\HelloWorld.cpp" and run the resulting file "HelloWorld.exe". + +cl can be found in C:\Program Files (x86)\\VC\bin +(e.g. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin) +or you can open a visual studio command prompt which adds the correct paths to its environment. + +Under Linux - using the gcc compiler: +g++ src\HelloWorld.cpp && a.out \ No newline at end of file diff --git a/challenge_0/cpp/sven/src/HelloWorld.cpp b/challenge_0/cpp/sven/src/HelloWorld.cpp new file mode 100644 index 000000000..22246eadc --- /dev/null +++ b/challenge_0/cpp/sven/src/HelloWorld.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::cout << "Hello World!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/challenge_0/csharp/sven/README.md b/challenge_0/csharp/sven/README.md new file mode 100644 index 000000000..697a91905 --- /dev/null +++ b/challenge_0/csharp/sven/README.md @@ -0,0 +1,7 @@ +#Challenge_0 Solution + +To compile run "csc.exe src\HelloWorld.cs" and run the resulting file "HelloWorld.exe". + +csc can be found in \Microsoft.NET\\<.NET version> +(e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319) +or you can open a visual studio command prompt which adds the correct paths to its environment. \ No newline at end of file diff --git a/challenge_0/csharp/sven/src/HelloWorld.cs b/challenge_0/csharp/sven/src/HelloWorld.cs new file mode 100644 index 000000000..b9c84eb38 --- /dev/null +++ b/challenge_0/csharp/sven/src/HelloWorld.cs @@ -0,0 +1,12 @@ +using System; + +namespace Challenge_0 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} \ No newline at end of file diff --git a/challenge_1/cpp/sven/README.md b/challenge_1/cpp/sven/README.md new file mode 100644 index 000000000..727a96f39 --- /dev/null +++ b/challenge_1/cpp/sven/README.md @@ -0,0 +1,12 @@ +#Challenge_0 Solution + +Under Windows - using the Visual studio c++ compiler: +To compile, run: "cl.exe src\Reverse.cpp" +and run the resulting file with your sentence to reverse as arguments: "Reverse.exe Hello World!". + +cl can be found in C:\Program Files (x86)\\VC\bin +(e.g. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin) +or you can open a visual studio command prompt which adds the correct paths to its environment. + +Under Linux - using the gcc compiler: +g++ src\Reverse.cpp && a.out \ No newline at end of file diff --git a/challenge_1/cpp/sven/src/Reverse.cpp b/challenge_1/cpp/sven/src/Reverse.cpp new file mode 100644 index 000000000..aaf2b3d63 --- /dev/null +++ b/challenge_1/cpp/sven/src/Reverse.cpp @@ -0,0 +1,15 @@ +#include +#include + +int main(int argc, char* argv[]) +{ + for (int i = argc - 1; i > 0; --i) + { + std::string word = argv[i]; + for (std::string::reverse_iterator rit = word.rbegin(); rit != word.rend(); ++rit) + std::cout << *rit; + std::cout << " "; + } + std::cout << std::endl; + return 0; +} \ No newline at end of file diff --git a/challenge_1/csharp/sven/README.md b/challenge_1/csharp/sven/README.md new file mode 100644 index 000000000..5886f6b48 --- /dev/null +++ b/challenge_1/csharp/sven/README.md @@ -0,0 +1,8 @@ +#Challenge_1 Solution + +To compile run: "csc.exe src\Reverse.cs" +and run the resulting file with your sentence to reverse as arguments: "Reverse.exe Hello World!". + +csc can be found in \Microsoft.NET\\<.NET version> +(e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319) +or you can open a visual studio command prompt which adds the correct paths to its environment. \ No newline at end of file diff --git a/challenge_1/csharp/sven/src/Reverse.cs b/challenge_1/csharp/sven/src/Reverse.cs new file mode 100644 index 000000000..4e4376dbd --- /dev/null +++ b/challenge_1/csharp/sven/src/Reverse.cs @@ -0,0 +1,15 @@ +using System; +using System.Linq; + +namespace Challenge_1 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine( + args.Aggregate("", (sentence, word) => word.Aggregate("", (w, character) => character + w) + " " + sentence) + ); + } + } +} \ No newline at end of file diff --git a/challenge_2/cpp/sven/README.md b/challenge_2/cpp/sven/README.md new file mode 100644 index 000000000..cd8c0fb1f --- /dev/null +++ b/challenge_2/cpp/sven/README.md @@ -0,0 +1,12 @@ +#Challenge_2 Solution + +Under Windows - using the Visual studio c++ compiler: +To compile, run: "cl.exe src\Single.cpp" +and run the resulting file with your sequence as arguments: "Single.exe 2 3 4 3 2 3 a a". + +cl can be found in C:\Program Files (x86)\\VC\bin +(e.g. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin) +or you can open a visual studio command prompt which adds the correct paths to its environment. + +Under Linux - using the gcc compiler: +g++ src\Single.cpp && a.out diff --git a/challenge_2/cpp/sven/src/Single.cpp b/challenge_2/cpp/sven/src/Single.cpp new file mode 100644 index 000000000..396d7989b --- /dev/null +++ b/challenge_2/cpp/sven/src/Single.cpp @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + std::unordered_map map; + for (int i =1; i < argc; ++i) + { + std::string el = argv[i]; + if (map.find(el) == map.cend()) + { + map[el] = true; + } + else + { + map[el] = false; + } + } + std::cout << std::find_if(map.cbegin(), map.cend(), [](const std::unordered_map::value_type& vt) { return vt.second; })->first << std::endl; +} \ No newline at end of file diff --git a/challenge_2/csharp/sven/README.md b/challenge_2/csharp/sven/README.md new file mode 100644 index 000000000..16fcfdc4b --- /dev/null +++ b/challenge_2/csharp/sven/README.md @@ -0,0 +1,8 @@ +# Challenge_2 Solution + +To compile run: "csc.exe src\Single.cs" +and run the resulting file with your sequence as arguments: "Single.exe 2 3 4 3 2 3 a a". + +csc can be found in \Microsoft.NET\\<.NET version> +(e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319) +or you can open a visual studio command prompt which adds the correct paths to its environment. diff --git a/challenge_2/csharp/sven/src/Single.cs b/challenge_2/csharp/sven/src/Single.cs new file mode 100644 index 000000000..66d44f824 --- /dev/null +++ b/challenge_2/csharp/sven/src/Single.cs @@ -0,0 +1,26 @@ +using System; +using System.Linq; +using System.Collections.Generic; + +namespace Challenge_2 +{ + class Program + { + static void Main(string[] args) + { + Dictionary dic = new Dictionary(); + foreach(string el in args) + { + if(dic.ContainsKey(el)) + { + dic[el] = false; + } + else + { + dic[el] = true; + } + } + Console.WriteLine(dic.First((el) => el.Value).Key); + } + } +} \ No newline at end of file From a4304c45a92d433879ebe8c8b76a844dd1990286 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 11 Jan 2017 09:57:14 -0800 Subject: [PATCH 25/95] Python Challenge 0 (Unreviewed) --- challenge_0/python/mindovermiles262/README.md | 5 +++++ challenge_0/python/mindovermiles262/src/challenge_00.py | 1 + 2 files changed, 6 insertions(+) create mode 100644 challenge_0/python/mindovermiles262/README.md create mode 100644 challenge_0/python/mindovermiles262/src/challenge_00.py diff --git a/challenge_0/python/mindovermiles262/README.md b/challenge_0/python/mindovermiles262/README.md new file mode 100644 index 000000000..6085c40bf --- /dev/null +++ b/challenge_0/python/mindovermiles262/README.md @@ -0,0 +1,5 @@ +# Challenge 000 +A simple program to write hello world. + +To run: Naviage to directory using command prompt using cd and ls +Type "python challenge_00.py" \ No newline at end of file diff --git a/challenge_0/python/mindovermiles262/src/challenge_00.py b/challenge_0/python/mindovermiles262/src/challenge_00.py new file mode 100644 index 000000000..3c85ea1a8 --- /dev/null +++ b/challenge_0/python/mindovermiles262/src/challenge_00.py @@ -0,0 +1 @@ +print("Hello, World") \ No newline at end of file From 4fc3486cf2db150d25838b455d68d4537b658e53 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 11:08:33 -0800 Subject: [PATCH 26/95] Test files for Ch10 (#373) * new test * fixed testfiles and readme * made testfiles * testfiles created --- challenge_10/README.md | 2 +- challenge_10/testfiles/o1 | 1 + challenge_10/testfiles/o10 | 1 + challenge_10/testfiles/o11 | 1 + challenge_10/testfiles/o12 | 1 + challenge_10/testfiles/o13 | 1 + challenge_10/testfiles/o14 | 1 + challenge_10/testfiles/o2 | 1 + challenge_10/testfiles/o3 | 1 + challenge_10/testfiles/o4 | 1 + challenge_10/testfiles/o5 | 1 + challenge_10/testfiles/o6 | 1 + challenge_10/testfiles/o7 | 1 + challenge_10/testfiles/o8 | 1 + challenge_10/testfiles/o9 | 1 + challenge_10/{tests/test1 => testfiles/t1} | 0 challenge_10/testfiles/t10 | 1 + challenge_10/testfiles/t11 | 1 + challenge_10/testfiles/t12 | 1 + challenge_10/testfiles/t13 | 1 + challenge_10/testfiles/t14 | 1 + challenge_10/{tests/test2 => testfiles/t2} | 0 challenge_10/{tests/test3 => testfiles/t3} | 0 challenge_10/{tests/test4 => testfiles/t4} | 0 challenge_10/{tests/test5 => testfiles/t5} | 0 challenge_10/testfiles/t6 | 1 + challenge_10/testfiles/t7 | 1 + challenge_10/testfiles/t8 | 1 + challenge_10/testfiles/t9 | 1 + 29 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 challenge_10/testfiles/o1 create mode 100644 challenge_10/testfiles/o10 create mode 100644 challenge_10/testfiles/o11 create mode 100644 challenge_10/testfiles/o12 create mode 100644 challenge_10/testfiles/o13 create mode 100644 challenge_10/testfiles/o14 create mode 100644 challenge_10/testfiles/o2 create mode 100644 challenge_10/testfiles/o3 create mode 100644 challenge_10/testfiles/o4 create mode 100644 challenge_10/testfiles/o5 create mode 100644 challenge_10/testfiles/o6 create mode 100644 challenge_10/testfiles/o7 create mode 100644 challenge_10/testfiles/o8 create mode 100644 challenge_10/testfiles/o9 rename challenge_10/{tests/test1 => testfiles/t1} (100%) create mode 100644 challenge_10/testfiles/t10 create mode 100644 challenge_10/testfiles/t11 create mode 100644 challenge_10/testfiles/t12 create mode 100644 challenge_10/testfiles/t13 create mode 100644 challenge_10/testfiles/t14 rename challenge_10/{tests/test2 => testfiles/t2} (100%) rename challenge_10/{tests/test3 => testfiles/t3} (100%) rename challenge_10/{tests/test4 => testfiles/t4} (100%) rename challenge_10/{tests/test5 => testfiles/t5} (100%) create mode 100644 challenge_10/testfiles/t6 create mode 100644 challenge_10/testfiles/t7 create mode 100644 challenge_10/testfiles/t8 create mode 100644 challenge_10/testfiles/t9 diff --git a/challenge_10/README.md b/challenge_10/README.md index b888a359d..3dd5ae621 100644 --- a/challenge_10/README.md +++ b/challenge_10/README.md @@ -9,7 +9,7 @@ Your solution should use a maximum of O(N) space and run in O(N) time (max). What is the best data structure for this problem? Please make your program so that it takes input from standard input. System.in for you java folks and input() for you pythonistas. -Testing +[Testing](https://github.com/YearOfProgramming/2017Challenges#testing) ------ Instead of describing each test case, I'm just going to list them out here since I'm sure you can imagine what they might be. diff --git a/challenge_10/testfiles/o1 b/challenge_10/testfiles/o1 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o1 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o10 b/challenge_10/testfiles/o10 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o10 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o11 b/challenge_10/testfiles/o11 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o11 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o12 b/challenge_10/testfiles/o12 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o12 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o13 b/challenge_10/testfiles/o13 new file mode 100644 index 000000000..bc59c12aa --- /dev/null +++ b/challenge_10/testfiles/o13 @@ -0,0 +1 @@ +False diff --git a/challenge_10/testfiles/o14 b/challenge_10/testfiles/o14 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o14 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o2 b/challenge_10/testfiles/o2 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o2 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o3 b/challenge_10/testfiles/o3 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o3 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o4 b/challenge_10/testfiles/o4 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o4 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o5 b/challenge_10/testfiles/o5 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o5 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o6 b/challenge_10/testfiles/o6 new file mode 100644 index 000000000..bc59c12aa --- /dev/null +++ b/challenge_10/testfiles/o6 @@ -0,0 +1 @@ +False diff --git a/challenge_10/testfiles/o7 b/challenge_10/testfiles/o7 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o7 @@ -0,0 +1 @@ +True diff --git a/challenge_10/testfiles/o8 b/challenge_10/testfiles/o8 new file mode 100644 index 000000000..bc59c12aa --- /dev/null +++ b/challenge_10/testfiles/o8 @@ -0,0 +1 @@ +False diff --git a/challenge_10/testfiles/o9 b/challenge_10/testfiles/o9 new file mode 100644 index 000000000..0ca95142b --- /dev/null +++ b/challenge_10/testfiles/o9 @@ -0,0 +1 @@ +True diff --git a/challenge_10/tests/test1 b/challenge_10/testfiles/t1 similarity index 100% rename from challenge_10/tests/test1 rename to challenge_10/testfiles/t1 diff --git a/challenge_10/testfiles/t10 b/challenge_10/testfiles/t10 new file mode 100644 index 000000000..f193280c9 --- /dev/null +++ b/challenge_10/testfiles/t10 @@ -0,0 +1 @@ +[[[[[[[[[kafjalfeianfailfeja;fjai;efa;sfj]]]]]]]]]kjajdain diff --git a/challenge_10/testfiles/t11 b/challenge_10/testfiles/t11 new file mode 100644 index 000000000..cfc4083b9 --- /dev/null +++ b/challenge_10/testfiles/t11 @@ -0,0 +1 @@ +< blank > diff --git a/challenge_10/testfiles/t12 b/challenge_10/testfiles/t12 new file mode 100644 index 000000000..97d255669 --- /dev/null +++ b/challenge_10/testfiles/t12 @@ -0,0 +1 @@ +((((((fjdalfeja((((alefjalisj(())))))))))))d diff --git a/challenge_10/testfiles/t13 b/challenge_10/testfiles/t13 new file mode 100644 index 000000000..e354df97a --- /dev/null +++ b/challenge_10/testfiles/t13 @@ -0,0 +1 @@ +)))(((d diff --git a/challenge_10/testfiles/t14 b/challenge_10/testfiles/t14 new file mode 100644 index 000000000..fcb538a37 --- /dev/null +++ b/challenge_10/testfiles/t14 @@ -0,0 +1 @@ +({)} diff --git a/challenge_10/tests/test2 b/challenge_10/testfiles/t2 similarity index 100% rename from challenge_10/tests/test2 rename to challenge_10/testfiles/t2 diff --git a/challenge_10/tests/test3 b/challenge_10/testfiles/t3 similarity index 100% rename from challenge_10/tests/test3 rename to challenge_10/testfiles/t3 diff --git a/challenge_10/tests/test4 b/challenge_10/testfiles/t4 similarity index 100% rename from challenge_10/tests/test4 rename to challenge_10/testfiles/t4 diff --git a/challenge_10/tests/test5 b/challenge_10/testfiles/t5 similarity index 100% rename from challenge_10/tests/test5 rename to challenge_10/testfiles/t5 diff --git a/challenge_10/testfiles/t6 b/challenge_10/testfiles/t6 new file mode 100644 index 000000000..227b98e4a --- /dev/null +++ b/challenge_10/testfiles/t6 @@ -0,0 +1 @@ +{{{{{{{{{adfkjaefia}}}}}}} diff --git a/challenge_10/testfiles/t7 b/challenge_10/testfiles/t7 new file mode 100644 index 000000000..38ae55efc --- /dev/null +++ b/challenge_10/testfiles/t7 @@ -0,0 +1 @@ +{{{{{{{{{[[[[[[kadfa{{{{{{{((({daljfdaf({{{[]}}kaldjfs})})))}}}}}}}]]]]]]}kjfela}}}}}}}} diff --git a/challenge_10/testfiles/t8 b/challenge_10/testfiles/t8 new file mode 100644 index 000000000..18f7b56d4 --- /dev/null +++ b/challenge_10/testfiles/t8 @@ -0,0 +1 @@ +{{{[}}}}dafda diff --git a/challenge_10/testfiles/t9 b/challenge_10/testfiles/t9 new file mode 100644 index 000000000..307f7a70c --- /dev/null +++ b/challenge_10/testfiles/t9 @@ -0,0 +1 @@ +{{{{{{{{{}}}}}}}}} From 7cedcd31a37d91b8374721e0aa51a0915964d38c Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 11:53:50 -0800 Subject: [PATCH 27/95] Ch10 Testfiles corrected (#374) * new test * fixed testfiles and readme * made testfiles * testfiles created * fixed testfiles From 1cbaa1425bce2b0ce433fe0678e7a82d0b11f70e Mon Sep 17 00:00:00 2001 From: x95 Date: Wed, 11 Jan 2017 22:57:58 +0100 Subject: [PATCH 28/95] [x86] Challenge 10 (Unreviewed) (#347) * challenge_1 in x86asm * Update reversestring.s Fixed Restoring * [x86] challenge 7 * [x86] Challenge 10 (Unreviewed) * Added Readme Challenge_10 x86 * Fixing nesting --- challenge_10/x86/x95/README.md | 16 ++++ challenge_10/x86/x95/src/brackets.s | 104 +++++++++++++++++++++++++ challenge_10/x86/x95/src/challenge10.c | 22 ++++++ 3 files changed, 142 insertions(+) create mode 100644 challenge_10/x86/x95/README.md create mode 100644 challenge_10/x86/x95/src/brackets.s create mode 100644 challenge_10/x86/x95/src/challenge10.c diff --git a/challenge_10/x86/x95/README.md b/challenge_10/x86/x95/README.md new file mode 100644 index 000000000..32383eb16 --- /dev/null +++ b/challenge_10/x86/x95/README.md @@ -0,0 +1,16 @@ +#Checking Brackets in x86-Assembly (64-Bit) + +##Contents +brackets.s contains the main fuction check_brackets checks the input for correct formatting. + +The caller to the function only needs to provide the String. +##Compiling +``` +$ as brackets.s -o brackets.o +$ gcc -m64 challenge10.c brackets.o -o c10 +``` +tested on Ubuntu 16.04 64-Bit +##Testing +To test the implementation just start the c10 application and type the testcases in. + +The C file will call the asm function. Please take note, that this ASM file follows the AMD64 calling convention and not the Microsoft calling convention. Therefore it can only work on Linux/OSX/*NIX. diff --git a/challenge_10/x86/x95/src/brackets.s b/challenge_10/x86/x95/src/brackets.s new file mode 100644 index 000000000..a1ba3c450 --- /dev/null +++ b/challenge_10/x86/x95/src/brackets.s @@ -0,0 +1,104 @@ +.text +.global check_brackets + +check_brackets: + #x86 Prolog + pushq %rbp + movq %rsp, %rbp + + #%rdi input + #Get ready for some jumpy action... sorry + + #clear registers + xorq %rax,%rax #general counter + xorq %r8,%r8 #counting () + xorq %r9,%r9 #counting [] + xorq %r10,%r10 #counting {} + xorq %r11,%r11 #Checking stack/correct nesting + + #main method + stringloop: + movb (%rdi),%al #get the current character, abort if NULL-Terminator + test %al,%al + je skiploop + + #check for () + cmp $40,%al + jne skip_open_round + pushq $1 #push one open ( + inc %r8 + skip_open_round: + + cmp $41,%al + jne skip_close_round + dec %r8 + test %r8,%r8 #)( is not allowed + js return_false + popq %r11 + cmp $1,%r11 #everything between () closed? + jne return_false + skip_close_round: + + #check for [] + cmp $91,%al + jne skip_open_rect + pushq $2 #push one open [ + inc %r9 + skip_open_rect: + + cmp $93,%al + jne skip_close_rect + dec %r9 + test %r9,%r9 #][ is not allowed + js return_false + popq %r11 + cmp $2,%r11 #everything between [] closed? + jne return_false + skip_close_rect: + + #check for {} + cmp $123,%al + jne skip_open_fancy + pushq $3 #push one open { + inc %r10 + skip_open_fancy: + + cmp $125,%al + jne skip_close_fancy + dec %r10 + test %r10,%r10 #}{ is not allowed + js return_false + popq %r11 + cmp $3,%r11 #everything between {} closed? + jne return_false + skip_close_fancy: + + inc %rdi #move to next char + jmp stringloop + + skiploop: + + #clear register once again + xorq %rax,%rax + + #add all counters + add %r8,%rax + add %r9,%rax + add %r10,%rax + + #if Addition >0, not everything is closed + test %rax,%rax + je return_true + + return_false: + xorq %rax,%rax + jmp epilog + + return_true: + inc %rax + + epilog: + #x86 Epilog + movq %rbp , %rsp + popq %rbp + ret diff --git a/challenge_10/x86/x95/src/challenge10.c b/challenge_10/x86/x95/src/challenge10.c new file mode 100644 index 000000000..28d2921bd --- /dev/null +++ b/challenge_10/x86/x95/src/challenge10.c @@ -0,0 +1,22 @@ +#include +#include + +/* prototype for asm function */ +extern int check_brackets(char input[]); + +int main() +{ + //Remember that for C: False = 0, True =/= 0 + char* inputbuf; + int check = 0; + while(1) + { + inputbuf = calloc(1024,sizeof(char)); + printf("Input: "); + fgets(inputbuf,1024,stdin); + check = check_brackets(inputbuf); + printf("%d\n",check); + free(inputbuf); + } + return 0; +} \ No newline at end of file From 5767d2d30dd58d8341c2a35da93f331d78d7c94c Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 14:49:05 -0800 Subject: [PATCH 29/95] Ch9 Testfiles (#377) * new test * fixed testfiles and readme * made testfiles * testfiles created * fixed testfiles * ch9 testfiles * remved extra tests --- challenge_10/testfiles/o10 | 1 - challenge_10/testfiles/o11 | 1 - challenge_10/testfiles/o12 | 1 - challenge_10/testfiles/o13 | 1 - challenge_10/testfiles/o14 | 1 - challenge_10/testfiles/t10 | 1 - challenge_10/testfiles/t11 | 1 - challenge_10/testfiles/t12 | 1 - challenge_10/testfiles/t13 | 1 - challenge_10/testfiles/t14 | 1 - challenge_9/testfiles/o1 | 400 +++++++++++++++ challenge_9/testfiles/o2 | 400 +++++++++++++++ challenge_9/testfiles/o3 | 1000 ++++++++++++++++++++++++++++++++++++ challenge_9/testfiles/o4 | 1000 ++++++++++++++++++++++++++++++++++++ challenge_9/testfiles/o5 | 400 +++++++++++++++ challenge_9/testfiles/o6 | 400 +++++++++++++++ challenge_9/testfiles/t1 | 1 + challenge_9/testfiles/t2 | 1 + challenge_9/testfiles/t3 | 1 + challenge_9/testfiles/t4 | 1 + challenge_9/testfiles/t5 | 1 + challenge_9/testfiles/t6 | 1 + 22 files changed, 3606 insertions(+), 10 deletions(-) delete mode 100644 challenge_10/testfiles/o10 delete mode 100644 challenge_10/testfiles/o11 delete mode 100644 challenge_10/testfiles/o12 delete mode 100644 challenge_10/testfiles/o13 delete mode 100644 challenge_10/testfiles/o14 delete mode 100644 challenge_10/testfiles/t10 delete mode 100644 challenge_10/testfiles/t11 delete mode 100644 challenge_10/testfiles/t12 delete mode 100644 challenge_10/testfiles/t13 delete mode 100644 challenge_10/testfiles/t14 create mode 100644 challenge_9/testfiles/o1 create mode 100644 challenge_9/testfiles/o2 create mode 100644 challenge_9/testfiles/o3 create mode 100644 challenge_9/testfiles/o4 create mode 100644 challenge_9/testfiles/o5 create mode 100644 challenge_9/testfiles/o6 create mode 100644 challenge_9/testfiles/t1 create mode 100644 challenge_9/testfiles/t2 create mode 100644 challenge_9/testfiles/t3 create mode 100644 challenge_9/testfiles/t4 create mode 100644 challenge_9/testfiles/t5 create mode 100644 challenge_9/testfiles/t6 diff --git a/challenge_10/testfiles/o10 b/challenge_10/testfiles/o10 deleted file mode 100644 index 0ca95142b..000000000 --- a/challenge_10/testfiles/o10 +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/challenge_10/testfiles/o11 b/challenge_10/testfiles/o11 deleted file mode 100644 index 0ca95142b..000000000 --- a/challenge_10/testfiles/o11 +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/challenge_10/testfiles/o12 b/challenge_10/testfiles/o12 deleted file mode 100644 index 0ca95142b..000000000 --- a/challenge_10/testfiles/o12 +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/challenge_10/testfiles/o13 b/challenge_10/testfiles/o13 deleted file mode 100644 index bc59c12aa..000000000 --- a/challenge_10/testfiles/o13 +++ /dev/null @@ -1 +0,0 @@ -False diff --git a/challenge_10/testfiles/o14 b/challenge_10/testfiles/o14 deleted file mode 100644 index 0ca95142b..000000000 --- a/challenge_10/testfiles/o14 +++ /dev/null @@ -1 +0,0 @@ -True diff --git a/challenge_10/testfiles/t10 b/challenge_10/testfiles/t10 deleted file mode 100644 index f193280c9..000000000 --- a/challenge_10/testfiles/t10 +++ /dev/null @@ -1 +0,0 @@ -[[[[[[[[[kafjalfeianfailfeja;fjai;efa;sfj]]]]]]]]]kjajdain diff --git a/challenge_10/testfiles/t11 b/challenge_10/testfiles/t11 deleted file mode 100644 index cfc4083b9..000000000 --- a/challenge_10/testfiles/t11 +++ /dev/null @@ -1 +0,0 @@ -< blank > diff --git a/challenge_10/testfiles/t12 b/challenge_10/testfiles/t12 deleted file mode 100644 index 97d255669..000000000 --- a/challenge_10/testfiles/t12 +++ /dev/null @@ -1 +0,0 @@ -((((((fjdalfeja((((alefjalisj(())))))))))))d diff --git a/challenge_10/testfiles/t13 b/challenge_10/testfiles/t13 deleted file mode 100644 index e354df97a..000000000 --- a/challenge_10/testfiles/t13 +++ /dev/null @@ -1 +0,0 @@ -)))(((d diff --git a/challenge_10/testfiles/t14 b/challenge_10/testfiles/t14 deleted file mode 100644 index fcb538a37..000000000 --- a/challenge_10/testfiles/t14 +++ /dev/null @@ -1 +0,0 @@ -({)} diff --git a/challenge_9/testfiles/o1 b/challenge_9/testfiles/o1 new file mode 100644 index 000000000..00739bea0 --- /dev/null +++ b/challenge_9/testfiles/o1 @@ -0,0 +1,400 @@ +49 +64 +144 +196 +324 +324 +361 +400 +441 +676 +729 +1225 +1521 +1600 +1764 +1764 +2025 +2116 +2500 +2916 +3364 +4096 +4225 +4356 +4624 +4900 +5329 +5625 +5776 +5929 +6241 +6400 +6561 +6889 +7056 +7225 +7396 +7569 +8281 +8464 +8464 +9025 +9025 +9216 +9801 +11664 +11664 +12100 +12321 +12544 +13225 +13456 +14641 +15129 +16129 +16641 +16900 +17161 +17689 +17956 +19044 +19321 +19600 +19881 +20164 +21025 +21904 +22201 +22500 +23409 +23409 +23716 +24336 +24649 +24649 +24964 +25600 +26244 +26569 +26569 +26896 +27225 +27225 +30625 +31329 +32400 +32400 +34225 +34596 +35721 +36100 +36481 +36864 +37249 +38416 +40401 +40804 +42849 +44521 +45369 +46656 +47524 +48400 +48400 +49729 +50176 +50625 +51076 +51529 +51529 +52441 +55225 +56169 +56644 +59536 +62500 +65536 +66564 +67600 +69169 +71824 +72900 +72900 +73441 +73984 +74529 +75625 +77284 +78400 +80656 +82944 +83521 +85264 +85849 +86436 +87616 +90601 +90601 +93025 +93025 +93636 +96100 +96100 +98596 +99225 +99856 +99856 +100489 +101761 +107584 +107584 +108900 +111556 +112896 +114921 +116281 +116964 +117649 +119025 +119716 +119716 +120409 +121104 +123904 +124609 +126025 +126736 +127449 +128164 +128164 +128881 +129600 +131769 +132496 +133225 +134689 +135424 +139129 +139876 +140625 +141376 +142129 +148225 +148996 +148996 +156816 +157609 +158404 +160801 +163216 +164025 +168921 +169744 +173889 +174724 +174724 +176400 +178084 +178929 +178929 +179776 +180625 +184041 +185761 +186624 +190969 +194481 +195364 +198025 +198916 +202500 +204304 +206116 +206116 +207936 +215296 +218089 +219961 +222784 +226576 +231361 +231361 +233289 +235225 +237169 +238144 +239121 +240100 +247009 +250000 +251001 +254016 +255025 +258064 +262144 +263169 +264196 +265225 +267289 +275625 +278784 +286225 +287296 +288369 +290521 +291600 +297025 +303601 +304704 +305809 +306916 +309136 +312481 +314721 +314721 +316969 +319225 +320356 +330625 +335241 +336400 +336400 +337561 +339889 +342225 +346921 +346921 +352836 +354025 +355216 +356409 +357604 +361201 +363609 +367236 +369664 +370881 +372100 +373321 +374544 +375769 +381924 +383161 +384400 +386884 +386884 +389376 +391876 +394384 +395641 +398161 +401956 +403225 +408321 +413449 +422500 +427716 +429025 +431649 +434281 +438244 +444889 +447561 +448900 +454276 +456976 +466489 +467856 +470596 +471969 +471969 +477481 +478864 +480249 +488601 +491401 +491401 +494209 +494209 +498436 +505521 +506944 +514089 +519841 +527076 +529984 +535824 +537289 +540225 +549081 +558009 +558009 +559504 +559504 +561001 +561001 +568516 +579121 +580644 +580644 +583696 +586756 +597529 +597529 +602176 +606841 +616225 +619369 +620944 +622521 +632025 +632025 +635209 +640000 +643204 +643204 +649636 +652864 +652864 +657721 +662596 +664225 +664225 +667489 +669124 +687241 +690561 +690561 +692224 +693889 +695556 +703921 +710649 +714025 +719104 +720801 +724201 +725904 +725904 +727609 +729316 +731025 +741321 +744769 +749956 +753424 +756900 +758641 +762129 +763876 +765625 +767376 +770884 +770884 +772641 +777924 +783225 +795664 +797449 +799236 diff --git a/challenge_9/testfiles/o2 b/challenge_9/testfiles/o2 new file mode 100644 index 000000000..36c492d5a --- /dev/null +++ b/challenge_9/testfiles/o2 @@ -0,0 +1,400 @@ +1 +9 +9 +16 +25 +81 +144 +529 +1024 +1089 +1156 +1444 +1521 +1600 +1764 +1849 +2116 +2209 +2209 +2304 +2500 +2916 +3025 +3136 +3844 +3969 +4356 +4624 +5329 +5776 +6724 +7569 +7921 +8836 +9025 +9604 +10201 +10816 +11025 +11236 +12544 +12996 +14161 +15129 +15376 +15625 +17689 +18225 +18496 +18769 +18769 +19044 +19321 +19600 +23104 +24964 +25281 +25921 +26244 +26896 +28224 +29584 +29584 +31329 +33124 +35344 +37249 +38025 +39204 +40000 +40804 +41209 +41616 +42849 +43264 +43681 +44100 +44521 +45369 +45369 +47089 +47524 +47961 +48400 +49284 +51076 +51984 +52441 +52900 +54289 +54756 +55696 +55696 +59049 +64516 +66564 +67081 +68644 +69169 +70756 +72900 +75076 +75625 +76729 +79524 +80089 +80656 +81225 +82944 +84681 +87616 +87616 +90000 +90000 +91204 +93025 +101124 +101124 +101761 +103041 +103684 +105625 +107584 +108241 +108241 +108900 +112225 +115600 +116281 +119025 +119716 +121104 +122500 +123904 +123904 +126025 +126025 +126736 +128164 +129600 +131044 +131769 +133956 +135424 +137641 +138384 +138384 +139129 +139876 +140625 +145161 +148996 +152100 +152881 +153664 +153664 +159201 +164025 +164025 +164836 +166464 +168921 +171396 +172225 +173056 +173056 +175561 +176400 +177241 +181476 +182329 +184041 +185761 +190096 +191844 +194481 +195364 +199809 +201601 +202500 +210681 +211600 +214369 +215296 +219024 +220900 +220900 +222784 +222784 +223729 +228484 +229441 +230400 +232324 +233289 +233289 +236196 +237169 +238144 +240100 +240100 +243049 +244036 +245025 +245025 +247009 +250000 +254016 +255025 +257049 +260100 +261121 +261121 +265225 +270400 +271441 +272484 +273529 +277729 +280900 +280900 +284089 +285156 +289444 +292681 +297025 +305809 +305809 +308025 +314721 +315844 +316969 +319225 +320356 +322624 +327184 +328329 +328329 +329476 +330625 +330625 +335241 +337561 +339889 +341056 +346921 +349281 +351649 +357604 +360000 +362404 +363609 +367236 +369664 +372100 +375769 +381924 +383161 +386884 +391876 +394384 +396900 +399424 +399424 +407044 +408321 +410881 +412164 +422500 +423801 +434281 +435600 +438244 +440896 +442225 +444889 +448900 +451584 +455625 +455625 +458329 +463761 +467856 +469225 +470596 +476100 +478864 +480249 +480249 +483025 +484416 +485809 +487204 +491401 +495616 +505521 +511225 +511225 +512656 +514089 +514089 +515524 +516961 +518400 +519841 +519841 +525625 +527076 +528529 +529984 +531441 +532900 +534361 +535824 +541696 +546121 +552049 +553536 +564001 +565504 +567009 +567009 +568516 +573049 +573049 +576081 +579121 +580644 +582169 +583696 +583696 +588289 +589824 +597529 +599076 +605284 +609961 +611524 +616225 +617796 +619369 +620944 +622521 +624100 +633616 +633616 +636804 +640000 +643204 +648025 +652864 +656100 +659344 +662596 +665856 +672400 +674041 +678976 +683929 +683929 +685584 +690561 +692224 +692224 +695556 +703921 +705600 +710649 +712336 +714025 +719104 +720801 +722500 +734449 +737881 +746496 +746496 +748225 +748225 +749956 +751689 +753424 +755161 +755161 +756900 +758641 +762129 +767376 +769129 +774400 +788544 +795664 +797449 +801025 +802816 +804609 +806404 +806404 +810000 +810000 diff --git a/challenge_9/testfiles/o3 b/challenge_9/testfiles/o3 new file mode 100644 index 000000000..068941851 --- /dev/null +++ b/challenge_9/testfiles/o3 @@ -0,0 +1,1000 @@ +0 +1 +9 +25 +25 +36 +49 +64 +64 +100 +100 +144 +256 +289 +324 +324 +361 +400 +441 +484 +529 +529 +576 +625 +729 +841 +841 +900 +900 +961 +1024 +1024 +1089 +1156 +1225 +1296 +1369 +1369 +1444 +1444 +1521 +1600 +1600 +1764 +2209 +2209 +2304 +2304 +2401 +2500 +2500 +2601 +2704 +2809 +2809 +2916 +3025 +3025 +3136 +3136 +3481 +3600 +3600 +3721 +3721 +3844 +3969 +4096 +4225 +4225 +4356 +4624 +5041 +5184 +5184 +5329 +5329 +5476 +5625 +5776 +5929 +6084 +6241 +6400 +6561 +6561 +6724 +6889 +7056 +7056 +7225 +7396 +7569 +7569 +8281 +8464 +8464 +8649 +8836 +9025 +9216 +9216 +9409 +9801 +10201 +10609 +10816 +11025 +11025 +11236 +11449 +12100 +12321 +12769 +13225 +13225 +13456 +13456 +13689 +14161 +14641 +14884 +14884 +15129 +15876 +15876 +16129 +16129 +16384 +16900 +17689 +18225 +18496 +18769 +19044 +19044 +19321 +19321 +19881 +20164 +20449 +20736 +21025 +21025 +21316 +21609 +21904 +21904 +22201 +22500 +22801 +23104 +23409 +23716 +24025 +24336 +24649 +24964 +25600 +25921 +25921 +26569 +26896 +27225 +27556 +27889 +27889 +28561 +28900 +29241 +29241 +29929 +30276 +30625 +30625 +30976 +30976 +31329 +31329 +31684 +31684 +32400 +32761 +33124 +33124 +33489 +33856 +34225 +34596 +34969 +35344 +35344 +35721 +35721 +36100 +36864 +36864 +37249 +37636 +38416 +38809 +39204 +39204 +39601 +40000 +40401 +40401 +40804 +42436 +42849 +42849 +43264 +43681 +44100 +44521 +44521 +44944 +45369 +45369 +45796 +46225 +46656 +47089 +47524 +47961 +48400 +48841 +49284 +49729 +49729 +50176 +50625 +51529 +51529 +52441 +52900 +53361 +54289 +54756 +54756 +55225 +55225 +55696 +56169 +57121 +57600 +58564 +60025 +60516 +61009 +61504 +61504 +62001 +62500 +63504 +64516 +65025 +65536 +66049 +66049 +67600 +67600 +68644 +68644 +69169 +69696 +70225 +73441 +73441 +73984 +75076 +75625 +75625 +76176 +76729 +77284 +79524 +80089 +80656 +81225 +82369 +82369 +83521 +84100 +84100 +84681 +84681 +85264 +85849 +86436 +87616 +88804 +88804 +89401 +89401 +90000 +91809 +92416 +92416 +93025 +93025 +93636 +94249 +94864 +95481 +95481 +96100 +96721 +96721 +97344 +98596 +99225 +99856 +100489 +100489 +101124 +102400 +102400 +103041 +103684 +104329 +106276 +108241 +108241 +108900 +108900 +110224 +110889 +111556 +113569 +113569 +115600 +116281 +116964 +117649 +119025 +121104 +121801 +123904 +124609 +126025 +126736 +127449 +127449 +128164 +128881 +128881 +129600 +129600 +131044 +131769 +131769 +132496 +133225 +133956 +135424 +136900 +136900 +137641 +139129 +141376 +141376 +142884 +142884 +143641 +143641 +144400 +145161 +145161 +145924 +145924 +146689 +147456 +147456 +148225 +149769 +151321 +151321 +152100 +152100 +152881 +152881 +153664 +154449 +155236 +156025 +156816 +157609 +158404 +158404 +159201 +160000 +160801 +160801 +162409 +163216 +163216 +164025 +164836 +165649 +165649 +166464 +167281 +168100 +169744 +170569 +170569 +173056 +173889 +174724 +175561 +176400 +177241 +178084 +178929 +179776 +181476 +182329 +183184 +184041 +184041 +185761 +185761 +187489 +187489 +188356 +188356 +189225 +189225 +190096 +190969 +190969 +192721 +193600 +195364 +196249 +196249 +197136 +198025 +198025 +198916 +200704 +200704 +201601 +203401 +203401 +204304 +205209 +206116 +207025 +208849 +208849 +210681 +211600 +211600 +212521 +212521 +214369 +215296 +218089 +219961 +220900 +221841 +222784 +223729 +224676 +225625 +228484 +228484 +229441 +230400 +231361 +231361 +232324 +232324 +236196 +237169 +239121 +240100 +241081 +243049 +244036 +245025 +246016 +246016 +247009 +250000 +250000 +251001 +252004 +253009 +253009 +255025 +255025 +256036 +257049 +257049 +260100 +261121 +261121 +262144 +263169 +264196 +264196 +265225 +267289 +267289 +268324 +268324 +271441 +272484 +274576 +274576 +276676 +276676 +277729 +278784 +281961 +281961 +284089 +284089 +285156 +286225 +288369 +288369 +289444 +290521 +291600 +292681 +293764 +294849 +295936 +295936 +297025 +298116 +299209 +299209 +300304 +300304 +301401 +302500 +305809 +306916 +308025 +309136 +309136 +310249 +311364 +312481 +314721 +315844 +316969 +316969 +318096 +318096 +319225 +320356 +321489 +322624 +322624 +324900 +324900 +326041 +327184 +327184 +329476 +332929 +334084 +335241 +336400 +339889 +339889 +341056 +342225 +343396 +344569 +344569 +345744 +348100 +349281 +351649 +352836 +355216 +355216 +356409 +356409 +357604 +358801 +360000 +362404 +363609 +363609 +366025 +366025 +367236 +369664 +370881 +372100 +373321 +374544 +375769 +375769 +376996 +378225 +379456 +379456 +380689 +380689 +381924 +383161 +383161 +385641 +386884 +386884 +388129 +388129 +389376 +390625 +393129 +394384 +394384 +395641 +398161 +399424 +400689 +403225 +405769 +407044 +408321 +408321 +410881 +412164 +412164 +413449 +413449 +414736 +416025 +416025 +417316 +419904 +422500 +422500 +423801 +425104 +426409 +427716 +427716 +429025 +429025 +430336 +432964 +432964 +434281 +435600 +438244 +439569 +440896 +442225 +443556 +443556 +444889 +444889 +447561 +447561 +448900 +448900 +450241 +451584 +451584 +452929 +452929 +454276 +455625 +456976 +456976 +458329 +458329 +459684 +459684 +463761 +463761 +465124 +466489 +467856 +469225 +471969 +474721 +476100 +477481 +480249 +481636 +481636 +483025 +483025 +484416 +487204 +487204 +488601 +490000 +490000 +491401 +492804 +497025 +497025 +498436 +498436 +502681 +502681 +504100 +506944 +508369 +508369 +509796 +511225 +512656 +515524 +516961 +518400 +519841 +521284 +522729 +522729 +525625 +525625 +528529 +529984 +531441 +532900 +532900 +534361 +537289 +540225 +540225 +541696 +543169 +544644 +546121 +546121 +549081 +552049 +553536 +555025 +558009 +559504 +562500 +564001 +565504 +567009 +568516 +568516 +570025 +571536 +576081 +577600 +580644 +582169 +585225 +586756 +586756 +588289 +589824 +591361 +591361 +592900 +594441 +595984 +595984 +597529 +602176 +603729 +606841 +611524 +611524 +613089 +613089 +616225 +616225 +620944 +624100 +627264 +628849 +630436 +630436 +632025 +635209 +635209 +636804 +638401 +638401 +640000 +641601 +641601 +643204 +644809 +646416 +646416 +649636 +649636 +652864 +654481 +656100 +657721 +659344 +659344 +660969 +662596 +665856 +665856 +667489 +669124 +670761 +674041 +675684 +680625 +683929 +685584 +687241 +688900 +688900 +692224 +695556 +698896 +700569 +703921 +705600 +707281 +708964 +710649 +712336 +712336 +714025 +717409 +717409 +722500 +724201 +725904 +725904 +729316 +731025 +731025 +734449 +734449 +736164 +737881 +737881 +741321 +743044 +744769 +744769 +746496 +748225 +749956 +749956 +751689 +751689 +755161 +755161 +756900 +758641 +758641 +763876 +765625 +767376 +769129 +770884 +772641 +774400 +774400 +776161 +777924 +779689 +781456 +783225 +784996 +784996 +786769 +792100 +793881 +795664 +797449 +801025 +802816 +802816 +804609 +806404 +806404 +808201 +810000 +810000 +811801 +811801 +813604 +813604 +815409 +820836 +824464 +824464 +826281 +826281 +828100 +828100 +829921 +831744 +831744 +833569 +835396 +837225 +839056 +839056 +842724 +844561 +846400 +848241 +848241 +850084 +850084 +851929 +853776 +855625 +857476 +859329 +863041 +863041 +864900 +866761 +866761 +868624 +870489 +872356 +872356 +876096 +876096 +877969 +881721 +883600 +885481 +885481 +887364 +889249 +889249 +891136 +893025 +896809 +896809 +898704 +898704 +902500 +902500 +904401 +904401 +906304 +906304 +908209 +908209 +910116 +912025 +913936 +913936 +915849 +915849 +919681 +921600 +923521 +923521 +927369 +927369 +929296 +933156 +937024 +940900 +942841 +944784 +944784 +946729 +948676 +948676 +950625 +958441 +960400 +966289 +968256 +968256 +970225 +972196 +972196 +974169 +974169 +976144 +976144 +982081 +984064 +986049 +986049 +988036 +988036 +990025 +990025 +992016 +994009 +1000000 diff --git a/challenge_9/testfiles/o4 b/challenge_9/testfiles/o4 new file mode 100644 index 000000000..dc881e1c4 --- /dev/null +++ b/challenge_9/testfiles/o4 @@ -0,0 +1,1000 @@ +1 +4 +9 +16 +49 +49 +64 +64 +81 +100 +121 +196 +225 +225 +256 +289 +289 +324 +400 +400 +441 +529 +676 +676 +784 +841 +961 +1024 +1089 +1225 +1296 +1444 +1444 +1521 +1600 +1681 +1681 +1764 +1936 +2025 +2209 +2209 +2304 +2401 +2401 +2601 +2704 +2809 +2809 +2916 +2916 +3025 +3136 +3364 +3481 +3600 +3721 +3969 +3969 +4096 +4225 +4356 +4356 +4489 +4624 +4900 +5041 +5184 +5184 +5625 +5625 +6084 +6084 +6241 +6400 +6400 +6724 +6889 +7056 +7056 +7225 +7569 +7744 +7921 +8100 +8100 +8281 +8464 +8464 +8649 +8649 +8836 +9216 +9409 +9409 +9604 +9604 +9801 +10201 +10404 +10609 +11025 +11025 +11449 +11449 +11881 +12100 +12321 +12544 +12769 +12769 +12996 +13924 +14400 +14400 +14884 +14884 +15129 +15376 +16129 +16384 +16641 +16900 +17161 +17161 +17424 +17689 +17956 +17956 +18225 +18225 +18496 +18769 +19044 +19044 +19321 +19321 +19881 +19881 +20164 +20449 +20449 +20736 +21025 +21316 +21316 +21609 +21904 +21904 +22201 +22500 +22500 +22801 +23104 +23409 +23716 +23716 +24336 +24649 +24964 +24964 +25281 +25281 +25921 +26569 +27225 +27889 +28224 +28900 +28900 +29241 +29584 +29929 +30276 +30625 +30625 +30976 +30976 +31329 +31684 +32041 +32041 +32761 +33489 +33856 +34596 +34969 +34969 +35344 +35344 +35721 +36100 +36481 +36864 +36864 +37636 +38416 +38809 +39204 +40000 +40401 +40401 +40804 +42025 +42436 +42436 +42849 +43264 +44100 +44100 +44521 +44521 +45369 +45796 +46225 +46656 +46656 +47089 +47524 +48400 +49284 +49729 +50176 +50625 +51984 +52441 +53361 +54289 +54289 +54756 +55696 +56169 +56169 +56644 +56644 +57600 +58081 +58564 +58564 +59049 +59536 +60025 +60025 +60516 +61009 +61009 +61504 +61504 +62001 +62500 +63504 +64009 +64009 +64516 +65536 +66049 +66049 +66564 +67081 +68644 +69169 +69696 +70225 +70756 +71289 +71289 +72361 +72361 +72900 +73984 +73984 +75076 +75625 +76729 +77284 +77841 +77841 +78961 +79524 +79524 +80089 +80656 +81796 +81796 +84100 +84681 +85849 +87025 +87025 +87616 +88209 +88804 +89401 +90000 +90601 +90601 +91204 +91809 +92416 +94249 +95481 +96100 +96100 +96721 +97344 +97969 +97969 +99225 +99856 +99856 +100489 +100489 +101124 +101761 +102400 +103684 +103684 +104329 +104329 +104976 +105625 +105625 +106276 +106929 +106929 +107584 +108241 +108241 +108900 +109561 +109561 +111556 +112225 +112896 +113569 +114921 +115600 +116964 +118336 +118336 +119025 +121801 +122500 +123201 +124609 +125316 +126736 +127449 +128881 +129600 +129600 +130321 +131769 +131769 +133225 +133225 +133956 +134689 +136161 +136161 +136900 +137641 +138384 +139876 +140625 +141376 +142129 +142129 +142884 +143641 +143641 +144400 +146689 +147456 +149769 +149769 +150544 +151321 +151321 +152100 +152881 +153664 +154449 +154449 +156025 +157609 +159201 +160801 +160801 +161604 +162409 +164836 +166464 +167281 +168921 +169744 +170569 +171396 +172225 +173056 +173056 +174724 +175561 +176400 +177241 +179776 +179776 +180625 +181476 +182329 +184041 +184900 +186624 +186624 +188356 +188356 +189225 +189225 +190096 +190096 +190969 +191844 +191844 +193600 +195364 +197136 +197136 +198025 +198916 +198916 +199809 +199809 +200704 +201601 +202500 +203401 +204304 +205209 +206116 +207936 +207936 +209764 +210681 +210681 +211600 +213444 +213444 +214369 +215296 +218089 +218089 +219024 +219961 +220900 +220900 +221841 +222784 +223729 +224676 +225625 +226576 +227529 +227529 +228484 +231361 +232324 +232324 +233289 +235225 +236196 +237169 +239121 +242064 +242064 +243049 +244036 +245025 +245025 +246016 +248004 +249001 +251001 +252004 +253009 +254016 +254016 +255025 +256036 +257049 +259081 +261121 +261121 +262144 +263169 +264196 +264196 +266256 +269361 +269361 +270400 +270400 +271441 +272484 +272484 +273529 +274576 +274576 +276676 +276676 +278784 +279841 +279841 +283024 +284089 +284089 +285156 +286225 +288369 +289444 +291600 +291600 +293764 +294849 +297025 +298116 +298116 +300304 +301401 +302500 +302500 +303601 +304704 +305809 +306916 +306916 +308025 +309136 +309136 +310249 +312481 +312481 +314721 +316969 +318096 +320356 +320356 +321489 +324900 +326041 +326041 +327184 +328329 +329476 +330625 +332929 +332929 +334084 +334084 +335241 +336400 +337561 +339889 +341056 +342225 +343396 +344569 +345744 +346921 +350464 +350464 +351649 +352836 +354025 +355216 +356409 +358801 +358801 +361201 +362404 +367236 +368449 +369664 +369664 +370881 +372100 +373321 +374544 +374544 +376996 +378225 +379456 +381924 +381924 +383161 +384400 +386884 +388129 +389376 +389376 +390625 +391876 +391876 +393129 +393129 +394384 +394384 +395641 +396900 +400689 +403225 +404496 +404496 +407044 +409600 +409600 +410881 +413449 +414736 +414736 +416025 +417316 +418609 +419904 +419904 +421201 +421201 +422500 +423801 +423801 +425104 +426409 +430336 +432964 +435600 +436921 +438244 +438244 +440896 +440896 +442225 +443556 +444889 +446224 +447561 +448900 +450241 +450241 +451584 +451584 +454276 +454276 +455625 +456976 +458329 +458329 +459684 +461041 +461041 +463761 +466489 +467856 +469225 +470596 +471969 +473344 +474721 +477481 +478864 +480249 +480249 +483025 +483025 +484416 +484416 +485809 +487204 +491401 +492804 +492804 +494209 +495616 +495616 +497025 +498436 +499849 +501264 +501264 +502681 +502681 +504100 +504100 +506944 +509796 +511225 +512656 +515524 +516961 +518400 +519841 +521284 +522729 +524176 +524176 +528529 +529984 +529984 +531441 +534361 +535824 +535824 +537289 +537289 +538756 +540225 +541696 +541696 +543169 +546121 +547600 +550564 +550564 +552049 +555025 +559504 +559504 +562500 +562500 +564001 +564001 +565504 +565504 +567009 +568516 +570025 +571536 +573049 +574564 +576081 +579121 +580644 +582169 +583696 +585225 +585225 +586756 +586756 +588289 +588289 +592900 +592900 +594441 +594441 +595984 +597529 +597529 +599076 +599076 +602176 +602176 +605284 +606841 +606841 +608400 +608400 +609961 +611524 +611524 +614656 +614656 +616225 +617796 +619369 +620944 +622521 +625681 +627264 +627264 +636804 +636804 +640000 +640000 +641601 +643204 +643204 +644809 +644809 +648025 +649636 +649636 +651249 +652864 +652864 +654481 +657721 +659344 +659344 +660969 +660969 +662596 +664225 +665856 +665856 +667489 +672400 +674041 +674041 +675684 +677329 +677329 +678976 +680625 +682276 +682276 +683929 +685584 +688900 +690561 +692224 +692224 +695556 +695556 +697225 +697225 +698896 +700569 +702244 +702244 +703921 +705600 +705600 +707281 +707281 +708964 +710649 +712336 +712336 +714025 +717409 +719104 +720801 +722500 +724201 +725904 +729316 +731025 +731025 +732736 +734449 +737881 +741321 +743044 +744769 +744769 +746496 +746496 +749956 +751689 +753424 +753424 +755161 +756900 +758641 +760384 +765625 +765625 +767376 +769129 +770884 +770884 +772641 +776161 +777924 +777924 +779689 +781456 +783225 +784996 +784996 +786769 +790321 +790321 +792100 +792100 +793881 +793881 +795664 +795664 +797449 +799236 +801025 +804609 +808201 +808201 +810000 +810000 +811801 +815409 +819025 +820836 +820836 +824464 +824464 +826281 +828100 +828100 +829921 +831744 +833569 +835396 +837225 +840889 +840889 +842724 +842724 +844561 +850084 +850084 +851929 +851929 +853776 +853776 +855625 +855625 +859329 +861184 +866761 +868624 +868624 +870489 +870489 +872356 +872356 +874225 +876096 +876096 +877969 +877969 +879844 +885481 +887364 +889249 +891136 +893025 +894916 +898704 +900601 +904401 +906304 +908209 +910116 +910116 +912025 +912025 +915849 +915849 +919681 +919681 +921600 +921600 +923521 +923521 +927369 +927369 +929296 +933156 +935089 +938961 +940900 +942841 +942841 +950625 +950625 +952576 +954529 +954529 +956484 +956484 +960400 +960400 +962361 +962361 +966289 +968256 +970225 +970225 +972196 +976144 +978121 +978121 +982081 +982081 +984064 +986049 +986049 +988036 +990025 +990025 +998001 +998001 +1000000 diff --git a/challenge_9/testfiles/o5 b/challenge_9/testfiles/o5 new file mode 100644 index 000000000..baa6bce1b --- /dev/null +++ b/challenge_9/testfiles/o5 @@ -0,0 +1,400 @@ +1 +25 +36 +100 +289 +324 +484 +484 +576 +625 +676 +729 +784 +841 +1369 +1444 +1521 +1600 +1600 +1764 +1936 +2116 +2500 +3025 +3136 +3249 +3364 +4225 +4356 +4624 +4900 +5041 +5184 +5329 +6084 +6724 +6724 +7056 +7569 +7744 +7921 +8100 +8649 +9025 +9604 +10609 +11025 +12100 +12996 +13689 +15376 +15625 +15625 +15876 +16129 +16384 +16641 +16900 +17956 +17956 +18496 +18769 +19600 +19881 +21025 +21316 +22201 +22801 +23104 +23716 +24336 +24649 +24649 +26569 +27225 +27225 +27556 +28224 +28561 +28900 +29929 +30276 +30625 +31329 +33124 +33489 +33856 +34225 +34596 +36864 +37249 +38809 +41209 +42436 +44521 +46656 +49729 +50176 +51076 +51529 +52441 +52900 +53824 +54289 +56169 +56644 +57121 +57121 +58564 +59536 +61009 +63504 +63504 +64009 +67600 +69169 +70756 +71824 +72361 +72900 +74529 +78400 +80656 +81796 +82944 +84681 +86436 +87025 +88209 +90000 +90601 +91809 +97969 +98596 +99225 +103041 +103684 +105625 +106929 +110224 +111556 +112225 +121801 +123201 +129600 +130321 +131769 +131769 +133956 +135424 +135424 +139129 +140625 +141376 +143641 +145924 +146689 +148225 +148996 +149769 +151321 +154449 +156025 +160801 +161604 +162409 +164836 +170569 +173056 +174724 +174724 +175561 +178084 +178929 +179776 +181476 +181476 +185761 +186624 +188356 +189225 +190096 +190969 +193600 +194481 +196249 +198025 +203401 +207025 +208849 +210681 +211600 +211600 +214369 +216225 +220900 +223729 +223729 +225625 +228484 +233289 +236196 +244036 +245025 +247009 +248004 +249001 +249001 +252004 +255025 +258064 +258064 +270400 +274576 +275625 +283024 +283024 +284089 +285156 +290521 +294849 +302500 +306916 +309136 +309136 +311364 +315844 +321489 +327184 +329476 +329476 +330625 +330625 +331776 +331776 +332929 +336400 +338724 +342225 +351649 +351649 +356409 +358801 +367236 +369664 +369664 +375769 +378225 +380689 +383161 +384400 +385641 +390625 +391876 +393129 +396900 +396900 +398161 +399424 +401956 +403225 +405769 +408321 +417316 +418609 +423801 +425104 +432964 +436921 +438244 +444889 +446224 +455625 +461041 +463761 +465124 +467856 +474721 +476100 +483025 +484416 +487204 +494209 +497025 +502681 +508369 +509796 +514089 +514089 +521284 +522729 +524176 +527076 +529984 +543169 +546121 +552049 +553536 +555025 +559504 +562500 +562500 +567009 +571536 +577600 +585225 +591361 +611524 +613089 +614656 +616225 +617796 +624100 +624100 +625681 +632025 +632025 +635209 +638401 +641601 +648025 +651249 +654481 +656100 +657721 +659344 +660969 +662596 +662596 +664225 +672400 +674041 +680625 +683929 +685584 +687241 +692224 +697225 +703921 +703921 +707281 +720801 +722500 +724201 +725904 +727609 +734449 +739600 +741321 +746496 +753424 +762129 +763876 +767376 +769129 +784996 +786769 +788544 +790321 +792100 +795664 +797449 +810000 +810000 +820836 +820836 +822649 +824464 +828100 +828100 +835396 +850084 +851929 +861184 +864900 +889249 +891136 +893025 +894916 +894916 +896809 +900601 +906304 +910116 +910116 +912025 +929296 +933156 +942841 +946729 +954529 +956484 +964324 +970225 +978121 +988036 +988036 +990025 +998001 +1000000 diff --git a/challenge_9/testfiles/o6 b/challenge_9/testfiles/o6 new file mode 100644 index 000000000..3ce95d7ed --- /dev/null +++ b/challenge_9/testfiles/o6 @@ -0,0 +1,400 @@ +9 +16 +36 +64 +121 +144 +196 +196 +256 +289 +324 +441 +625 +676 +729 +1225 +1296 +1369 +1681 +2025 +2116 +2304 +2500 +3025 +3249 +4096 +4225 +5041 +5476 +5625 +6241 +6724 +7744 +8649 +9216 +9409 +10404 +10404 +10609 +10816 +11025 +11449 +11449 +12100 +12321 +12544 +13689 +14161 +14641 +15376 +15625 +15876 +16384 +17424 +17424 +17689 +18225 +18769 +19881 +20449 +21609 +22500 +22500 +24025 +24025 +24336 +25281 +27556 +29241 +29584 +29929 +30625 +32041 +32400 +32761 +33489 +33856 +35344 +36864 +37636 +38025 +40401 +42436 +43264 +44100 +46656 +47089 +47524 +49284 +50176 +50176 +53824 +58081 +60025 +61009 +61504 +62001 +63001 +63504 +65025 +65025 +66564 +69169 +70225 +72361 +72900 +73441 +73984 +74529 +75625 +77284 +78400 +80656 +81225 +81796 +81796 +82944 +82944 +83521 +85264 +87616 +88804 +91204 +95481 +96100 +97969 +98596 +101124 +101761 +101761 +103684 +104329 +105625 +110889 +111556 +114244 +114244 +114921 +116964 +117649 +119025 +119716 +121104 +122500 +125316 +126736 +128164 +133956 +134689 +134689 +136161 +138384 +139876 +140625 +144400 +146689 +148996 +148996 +149769 +154449 +156025 +159201 +162409 +164025 +165649 +168100 +172225 +173889 +173889 +174724 +176400 +181476 +186624 +187489 +191844 +192721 +193600 +193600 +198025 +198916 +201601 +203401 +209764 +209764 +211600 +216225 +218089 +219961 +220900 +222784 +223729 +228484 +229441 +233289 +235225 +236196 +241081 +242064 +247009 +247009 +251001 +252004 +256036 +258064 +261121 +263169 +265225 +268324 +273529 +275625 +279841 +280900 +284089 +287296 +292681 +293764 +293764 +294849 +299209 +300304 +301401 +302500 +303601 +314721 +315844 +316969 +319225 +320356 +321489 +323761 +331776 +334084 +336400 +338724 +341056 +346921 +349281 +351649 +354025 +356409 +358801 +361201 +361201 +362404 +372100 +388129 +388129 +400689 +401956 +403225 +403225 +409600 +418609 +422500 +426409 +431649 +442225 +444889 +446224 +446224 +448900 +450241 +451584 +454276 +456976 +463761 +465124 +466489 +467856 +469225 +471969 +473344 +473344 +474721 +478864 +485809 +497025 +499849 +504100 +511225 +512656 +512656 +514089 +515524 +516961 +516961 +519841 +521284 +522729 +522729 +525625 +528529 +531441 +532900 +540225 +541696 +553536 +558009 +564001 +579121 +580644 +585225 +586756 +586756 +591361 +592900 +594441 +597529 +599076 +605284 +606841 +609961 +613089 +614656 +616225 +619369 +619369 +625681 +628849 +628849 +632025 +633616 +635209 +636804 +638401 +641601 +644809 +646416 +649636 +651249 +656100 +659344 +662596 +669124 +675684 +688900 +690561 +695556 +698896 +700569 +703921 +714025 +739600 +739600 +743044 +744769 +749956 +751689 +755161 +756900 +765625 +770884 +772641 +774400 +779689 +792100 +795664 +817216 +822649 +824464 +826281 +833569 +844561 +846400 +850084 +857476 +859329 +861184 +864900 +866761 +872356 +874225 +881721 +883600 +887364 +891136 +891136 +904401 +906304 +915849 +919681 +921600 +929296 +931225 +937024 +938961 +940900 +944784 +946729 +948676 +952576 +954529 +966289 +974169 +980100 +986049 +988036 +990025 +992016 +998001 diff --git a/challenge_9/testfiles/t1 b/challenge_9/testfiles/t1 new file mode 100644 index 000000000..4f771f64f --- /dev/null +++ b/challenge_9/testfiles/t1 @@ -0,0 +1 @@ +-894, -892, -879, -878, -876, -874, -873, -871, -870, -868, -866, -855, -854, -853, -852, -849, -845, -843, -834, -833, -831, -818, -817, -815, -814, -808, -802, -800, -797, -795, -779, -776, -773, -764, -762, -749, -748, -747, -735, -733, -728, -726, -717, -706, -703, -701, -691, -687, -683, -670, -662, -659, -657, -655, -654, -639, -624, -622, -620, -619, -618, -613, -610, -608, -606, -601, -597, -596, -594, -589, -585, -583, -581, -580, -563, -561, -559, -554, -540, -537, -513, -504, -489, -481, -476, -472, -467, -464, -456, -454, -452, -450, -445, -441, -437, -432, -425, -424, -423, -422, -418, -417, -412, -405, -404, -401, -398, -397, -396, -386, -375, -374, -373, -367, -359, -358, -356, -355, -353, -347, -346, -341, -328, -319, -317, -316, -315, -310, -306, -305, -301, -289, -288, -280, -275, -271, -270, -260, -244, -238, -237, -227, -225, -223, -220, -216, -201, -185, -180, -177, -175, -165, -164, -163, -157, -156, -153, -149, -148, -145, -142, -139, -129, -127, -123, -121, -111, -108, -96, -95, -92, -80, -79, -75, -70, -66, -65, -50, -46, -42, -39, -27, -26, -19, -18, -7, 8, 12, 14, 18, 20, 21, 35, 40, 42, 45, 54, 58, 64, 68, 73, 76, 77, 81, 83, 84, 85, 86, 87, 91, 92, 95, 99, 108, 110, 112, 115, 116, 130, 131, 133, 134, 138, 140, 141, 150, 153, 154, 157, 158, 160, 162, 163, 165, 180, 186, 189, 190, 191, 192, 193, 196, 202, 207, 211, 213, 218, 220, 224, 226, 227, 229, 235, 250, 256, 258, 263, 268, 270, 272, 273, 278, 284, 292, 293, 294, 296, 301, 305, 310, 314, 316, 328, 330, 334, 336, 339, 342, 343, 345, 346, 348, 352, 357, 358, 360, 363, 364, 365, 368, 376, 377, 385, 386, 411, 418, 420, 423, 429, 431, 442, 446, 454, 469, 481, 483, 485, 487, 488, 490, 497, 500, 501, 505, 508, 512, 514, 515, 517, 525, 528, 535, 536, 539, 545, 551, 552, 553, 556, 561, 565, 566, 575, 579, 580, 589, 595, 598, 603, 609, 611, 612, 622, 626, 628, 629, 631, 634, 635, 643, 650, 667, 669, 674, 676, 684, 686, 687, 692, 693, 699, 701, 703, 711, 712, 721, 732, 741, 747, 748, 749, 754, 761, 762, 766, 773, 785, 787, 788, 789, 795, 802, 806, 808, 811, 815, 829, 831, 832, 839, 848, 851, 852, 861, 863, 875, 878, 882, 885, 893 diff --git a/challenge_9/testfiles/t2 b/challenge_9/testfiles/t2 new file mode 100644 index 000000000..d213b6bbb --- /dev/null +++ b/challenge_9/testfiles/t2 @@ -0,0 +1 @@ +-900, -898, -896, -893, -892, -870, -869, -868, -867, -865, -864, -850, -849, -844, -843, -839, -834, -832, -831, -828, -827, -824, -821, -820, -810, -805, -802, -800, -798, -796, -789, -788, -787, -786, -782, -781, -768, -764, -759, -757, -753, -744, -731, -730, -729, -728, -727, -725, -721, -718, -717, -716, -715, -711, -698, -696, -695, -693, -692, -685, -684, -681, -675, -672, -670, -665, -664, -662, -660, -650, -632, -626, -622, -619, -613, -610, -602, -600, -598, -591, -584, -583, -581, -579, -575, -573, -572, -568, -563, -562, -555, -553, -545, -538, -534, -530, -527, -521, -511, -510, -507, -505, -504, -495, -494, -493, -490, -486, -483, -480, -479, -473, -472, -470, -468, -464, -463, -449, -447, -431, -429, -426, -421, -419, -416, -414, -408, -406, -405, -399, -392, -391, -386, -381, -372, -371, -368, -366, -362, -355, -352, -348, -335, -330, -329, -325, -322, -321, -319, -318, -305, -302, -300, -296, -291, -288, -284, -282, -274, -266, -263, -254, -236, -234, -233, -230, -229, -222, -219, -218, -217, -213, -211, -207, -203, -200, -198, -195, -193, -172, -168, -161, -138, -137, -135, -124, -123, -119, -112, -106, -101, -98, -95, -94, -89, -82, -73, -63, -62, -56, -55, -50, -48, -47, -46, -43, -42, -38, -34, -23, -12, -5, -3, 1, 3, 4, 9, 32, 33, 39, 40, 47, 54, 66, 68, 76, 87, 104, 105, 114, 125, 133, 136, 137, 139, 140, 152, 158, 159, 162, 164, 172, 177, 182, 188, 202, 204, 208, 209, 210, 213, 220, 226, 228, 236, 243, 258, 259, 262, 270, 275, 277, 283, 285, 296, 300, 318, 328, 329, 340, 341, 345, 346, 350, 352, 355, 356, 358, 360, 363, 372, 373, 374, 375, 390, 392, 405, 411, 415, 416, 420, 427, 436, 438, 441, 442, 450, 459, 460, 470, 472, 478, 482, 483, 487, 488, 490, 495, 497, 500, 511, 515, 520, 522, 523, 530, 533, 541, 553, 561, 565, 566, 573, 574, 575, 589, 593, 603, 606, 608, 618, 628, 630, 632, 638, 639, 641, 642, 651, 659, 667, 675, 677, 686, 690, 693, 697, 701, 704, 715, 717, 719, 720, 721, 726, 732, 736, 739, 743, 751, 752, 753, 754, 757, 761, 762, 763, 764, 767, 773, 774, 778, 785, 790, 796, 808, 812, 814, 816, 827, 832, 840, 845, 848, 857, 859, 864, 865, 866, 869, 871, 873, 876, 877, 880, 888, 895, 897, 898, 900 diff --git a/challenge_9/testfiles/t3 b/challenge_9/testfiles/t3 new file mode 100644 index 000000000..3d019ba73 --- /dev/null +++ b/challenge_9/testfiles/t3 @@ -0,0 +1 @@ +-1000, -996, -995, -994, -993, -988, -987, -986, -985, -984, -980, -974, -972, -971, -970, -966, -964, -963, -961, -960, -959, -957, -956, -955, -954, -953, -952, -951, -950, -948, -947, -944, -943, -942, -941, -940, -936, -934, -931, -929, -923, -922, -921, -918, -916, -915, -912, -911, -910, -909, -908, -906, -902, -901, -900, -898, -897, -896, -895, -893, -892, -891, -887, -886, -883, -880, -879, -878, -877, -871, -870, -869, -867, -866, -863, -862, -861, -859, -858, -857, -855, -852, -851, -850, -847, -844, -841, -839, -832, -830, -829, -827, -825, -822, -821, -817, -816, -814, -813, -812, -811, -808, -806, -804, -803, -801, -800, -799, -798, -797, -794, -792, -788, -785, -783, -782, -773, -772, -769, -766, -763, -759, -755, -754, -752, -751, -750, -747, -739, -735, -733, -730, -729, -728, -727, -725, -723, -718, -715, -713, -709, -706, -705, -700, -699, -698, -695, -694, -693, -687, -685, -684, -682, -681, -678, -677, -676, -675, -674, -673, -672, -671, -670, -669, -667, -666, -663, -660, -659, -658, -656, -655, -654, -650, -646, -645, -644, -643, -642, -639, -638, -637, -635, -632, -631, -628, -624, -623, -622, -619, -617, -616, -615, -614, -613, -611, -610, -609, -605, -603, -600, -599, -597, -596, -594, -590, -587, -586, -585, -583, -580, -574, -572, -571, -570, -568, -564, -563, -562, -561, -559, -556, -554, -548, -547, -545, -544, -543, -540, -539, -538, -537, -533, -531, -528, -527, -526, -524, -518, -517, -515, -514, -512, -511, -510, -507, -505, -503, -502, -501, -500, -497, -496, -495, -489, -487, -482, -481, -479, -478, -475, -474, -473, -472, -471, -470, -464, -463, -461, -460, -457, -451, -449, -448, -445, -444, -443, -440, -439, -437, -436, -435, -434, -433, -431, -429, -428, -427, -423, -420, -419, -418, -417, -416, -413, -412, -407, -406, -405, -404, -403, -401, -400, -399, -398, -397, -396, -393, -391, -390, -389, -387, -384, -382, -381, -379, -378, -376, -370, -368, -364, -363, -360, -359, -357, -356, -352, -343, -341, -337, -332, -330, -329, -323, -320, -318, -317, -316, -315, -312, -311, -309, -306, -305, -304, -299, -298, -294, -293, -291, -290, -287, -285, -284, -282, -278, -277, -275, -271, -264, -263, -262, -260, -257, -256, -252, -250, -249, -248, -247, -246, -240, -239, -236, -235, -234, -231, -229, -227, -223, -221, -219, -218, -213, -212, -211, -208, -207, -206, -201, -200, -199, -198, -197, -194, -193, -192, -190, -189, -188, -187, -185, -182, -178, -177, -176, -175, -171, -170, -169, -167, -166, -165, -164, -161, -160, -158, -155, -154, -151, -150, -149, -148, -147, -145, -142, -139, -138, -137, -135, -130, -128, -127, -126, -122, -121, -116, -115, -113, -110, -107, -106, -105, -103, -101, -99, -96, -95, -94, -93, -92, -91, -87, -86, -85, -84, -83, -82, -81, -80, -78, -77, -75, -73, -72, -68, -66, -65, -61, -60, -56, -55, -54, -53, -50, -49, -48, -47, -42, -40, -39, -38, -37, -34, -33, -32, -31, -30, -29, -27, -23, -19, -18, -12, -10, -8, -7, -6, -5, 0, 1, 3, 5, 8, 10, 16, 17, 18, 20, 21, 22, 23, 24, 25, 29, 30, 32, 35, 36, 37, 38, 40, 47, 48, 50, 51, 52, 53, 55, 56, 59, 60, 61, 62, 63, 64, 65, 71, 72, 73, 74, 76, 79, 81, 84, 87, 92, 96, 97, 104, 105, 111, 115, 116, 117, 119, 122, 123, 126, 127, 133, 136, 138, 139, 141, 143, 144, 145, 146, 148, 152, 153, 156, 157, 161, 163, 167, 171, 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, 184, 186, 188, 189, 192, 196, 198, 201, 202, 207, 209, 210, 211, 213, 214, 215, 216, 217, 220, 222, 223, 224, 225, 227, 230, 233, 234, 235, 237, 242, 245, 248, 254, 255, 257, 260, 262, 265, 271, 272, 274, 275, 276, 283, 287, 289, 290, 291, 292, 296, 298, 299, 300, 303, 304, 305, 307, 308, 309, 310, 311, 314, 317, 320, 321, 322, 326, 329, 330, 333, 334, 337, 340, 342, 345, 348, 349, 353, 355, 357, 358, 359, 360, 362, 363, 365, 366, 370, 371, 373, 376, 378, 379, 380, 381, 382, 383, 384, 385, 389, 390, 391, 392, 394, 395, 398, 401, 404, 407, 408, 409, 410, 413, 421, 422, 424, 426, 429, 431, 433, 434, 435, 437, 442, 443, 445, 446, 448, 451, 452, 453, 454, 455, 457, 459, 460, 461, 467, 469, 478, 480, 481, 482, 486, 490, 491, 493, 494, 496, 500, 503, 505, 506, 507, 511, 513, 514, 517, 518, 521, 522, 524, 526, 531, 533, 534, 535, 537, 541, 542, 544, 546, 547, 548, 549, 550, 553, 555, 556, 557, 558, 563, 564, 565, 566, 567, 568, 570, 572, 577, 578, 579, 583, 584, 587, 588, 591, 593, 596, 597, 598, 602, 603, 605, 606, 608, 612, 613, 616, 617, 618, 619, 621, 622, 623, 625, 627, 628, 629, 633, 639, 641, 642, 643, 645, 648, 650, 651, 652, 653, 654, 655, 658, 662, 664, 665, 666, 667, 669, 670, 672, 673, 676, 677, 678, 681, 683, 689, 690, 691, 694, 695, 696, 698, 700, 701, 702, 705, 706, 709, 710, 712, 713, 714, 716, 719, 720, 721, 722, 723, 725, 730, 731, 735, 736, 737, 738, 739, 741, 743, 744, 745, 748, 753, 754, 756, 760, 762, 765, 766, 767, 768, 769, 770, 771, 772, 776, 777, 779, 782, 783, 785, 790, 793, 794, 795, 797, 799, 801, 802, 804, 806, 809, 810, 812, 816, 818, 819, 828, 830, 834, 836, 837, 840, 842, 843, 844, 845, 847, 852, 854, 855, 857, 859, 863, 864, 865, 866, 867, 869, 871, 874, 875, 876, 880, 881, 882, 884, 885, 886, 890, 896, 898, 899, 900, 901, 902, 903, 908, 909, 910, 912, 913, 914, 916, 919, 920, 921, 922, 924, 925, 926, 927, 929, 930, 931, 932, 933, 934, 936, 937, 939, 941, 943, 945, 947, 948, 950, 951, 952, 953, 956, 957, 961, 963, 968, 972, 973, 974, 975, 979, 983, 984, 986, 987, 988, 991, 992, 993, 994, 995, 997 diff --git a/challenge_9/testfiles/t4 b/challenge_9/testfiles/t4 new file mode 100644 index 000000000..ef5e96d2d --- /dev/null +++ b/challenge_9/testfiles/t4 @@ -0,0 +1 @@ +-1000, -999, -995, -994, -993, -992, -991, -989, -988, -986, -985, -983, -981, -980, -978, -977, -976, -975, -971, -970, -969, -966, -963, -961, -960, -959, -957, -955, -954, -952, -948, -946, -944, -943, -937, -936, -935, -934, -933, -932, -927, -925, -924, -923, -922, -918, -917, -915, -914, -912, -910, -909, -908, -906, -905, -900, -899, -895, -894, -892, -891, -890, -889, -887, -886, -885, -884, -883, -882, -879, -878, -876, -875, -868, -866, -864, -863, -862, -857, -856, -855, -854, -852, -850, -847, -845, -844, -841, -840, -839, -838, -836, -835, -834, -832, -830, -827, -826, -825, -823, -822, -821, -816, -813, -812, -808, -807, -806, -805, -803, -802, -800, -798, -792, -789, -788, -786, -784, -782, -781, -780, -779, -778, -776, -774, -773, -771, -770, -767, -766, -765, -764, -762, -756, -755, -752, -751, -750, -748, -745, -743, -742, -737, -736, -735, -733, -732, -731, -728, -727, -724, -720, -719, -714, -710, -709, -708, -706, -704, -702, -701, -698, -697, -696, -695, -693, -689, -687, -686, -681, -679, -677, -674, -672, -671, -670, -667, -665, -664, -662, -660, -656, -653, -651, -650, -649, -648, -647, -646, -644, -643, -640, -636, -635, -633, -629, -628, -627, -626, -625, -624, -623, -622, -620, -619, -618, -616, -615, -614, -612, -611, -609, -608, -606, -602, -601, -599, -596, -592, -589, -585, -584, -583, -580, -579, -578, -577, -574, -571, -566, -564, -563, -559, -556, -555, -554, -553, -550, -546, -540, -538, -537, -535, -533, -532, -529, -526, -524, -522, -521, -520, -519, -514, -512, -511, -509, -507, -506, -504, -502, -499, -495, -493, -492, -485, -482, -477, -476, -474, -473, -472, -470, -469, -467, -462, -459, -458, -456, -453, -452, -450, -447, -446, -445, -444, -442, -440, -438, -436, -435, -434, -432, -424, -421, -419, -418, -416, -415, -413, -409, -402, -401, -399, -397, -395, -393, -391, -390, -389, -388, -387, -379, -377, -376, -370, -369, -366, -365, -363, -361, -360, -354, -351, -349, -345, -344, -342, -340, -335, -331, -329, -327, -326, -325, -324, -323, -322, -320, -319, -317, -316, -313, -312, -310, -309, -302, -301, -300, -298, -297, -295, -291, -290, -286, -282, -281, -279, -278, -277, -275, -272, -270, -269, -267, -265, -258, -257, -254, -253, -249, -248, -247, -246, -245, -243, -242, -241, -238, -237, -234, -233, -231, -228, -224, -223, -222, -220, -218, -216, -215, -214, -211, -210, -208, -207, -206, -205, -201, -198, -196, -194, -192, -191, -190, -189, -188, -187, -181, -179, -177, -176, -175, -174, -170, -168, -163, -159, -158, -157, -154, -152, -151, -150, -149, -148, -146, -145, -143, -141, -139, -138, -137, -136, -135, -134, -133, -131, -124, -122, -120, -118, -113, -112, -111, -110, -109, -107, -105, -102, -99, -98, -97, -94, -93, -92, -90, -89, -88, -85, -84, -83, -82, -80, -78, -75, -72, -70, -68, -67, -66, -63, -61, -58, -56, -54, -53, -49, -48, -47, -45, -41, -40, -38, -35, -29, -28, -26, -21, -20, -17, -15, -14, -10, -9, -8, -7, -4, -3, -2, -1, 7, 8, 11, 15, 16, 17, 18, 20, 23, 26, 31, 32, 33, 36, 38, 39, 41, 42, 44, 47, 49, 51, 52, 53, 54, 55, 59, 60, 63, 64, 65, 66, 71, 72, 75, 78, 79, 80, 84, 87, 90, 91, 92, 93, 96, 97, 98, 101, 103, 105, 107, 113, 114, 120, 122, 123, 127, 128, 129, 130, 131, 132, 134, 135, 138, 139, 141, 142, 143, 144, 146, 147, 148, 150, 153, 154, 156, 158, 159, 161, 165, 167, 170, 171, 172, 173, 175, 176, 178, 179, 183, 184, 186, 187, 188, 192, 197, 200, 201, 202, 206, 210, 211, 213, 216, 217, 225, 229, 233, 236, 237, 238, 240, 242, 244, 245, 247, 248, 250, 252, 253, 256, 257, 259, 262, 263, 264, 266, 267, 269, 272, 274, 279, 282, 283, 284, 286, 293, 295, 296, 299, 301, 303, 304, 307, 310, 311, 313, 315, 316, 317, 318, 322, 323, 325, 327, 328, 329, 330, 331, 334, 336, 337, 339, 344, 350, 353, 356, 357, 359, 360, 363, 365, 367, 369, 371, 372, 374, 375, 377, 378, 379, 380, 383, 384, 387, 389, 392, 393, 401, 403, 406, 408, 411, 412, 414, 416, 420, 424, 425, 426, 427, 429, 430, 432, 434, 435, 436, 437, 438, 444, 446, 447, 448, 449, 451, 454, 456, 459, 460, 462, 463, 464, 467, 468, 470, 471, 475, 477, 478, 481, 482, 483, 486, 487, 489, 492, 494, 495, 496, 498, 501, 503, 504, 505, 511, 513, 514, 516, 519, 520, 522, 523, 524, 526, 528, 529, 533, 534, 540, 542, 543, 545, 546, 548, 549, 550, 551, 552, 554, 556, 557, 559, 561, 566, 567, 570, 571, 572, 573, 575, 577, 578, 581, 586, 587, 588, 592, 593, 594, 595, 597, 599, 607, 608, 610, 612, 618, 624, 626, 627, 628, 630, 636, 638, 640, 641, 644, 645, 648, 649, 651, 652, 658, 661, 662, 664, 666, 668, 669, 671, 672, 674, 675, 676, 677, 678, 679, 683, 684, 685, 688, 691, 692, 693, 695, 696, 702, 703, 704, 705, 707, 708, 709, 710, 712, 715, 716, 718, 721, 722, 723, 724, 728, 729, 732, 733, 734, 736, 739, 740, 742, 748, 750, 751, 752, 753, 754, 757, 758, 759, 761, 763, 765, 766, 767, 770, 771, 772, 773, 774, 776, 779, 780, 782, 784, 785, 787, 791, 792, 798, 800, 801, 802, 803, 806, 808, 809, 811, 812, 813, 814, 815, 816, 817, 820, 821, 823, 824, 826, 828, 831, 832, 834, 835, 837, 838, 840, 841, 842, 843, 844, 848, 849, 851, 855, 859, 861, 863, 864, 867, 868, 869, 870, 871, 872, 875, 877, 878, 881, 882, 886, 889, 890, 891, 892, 893, 897, 899, 900, 901, 903, 906, 908, 910, 911, 913, 917, 918, 919, 922, 923, 924, 925, 928, 931, 932, 933, 934, 936, 937, 938, 941, 942, 945, 949, 951, 953, 954, 955, 957, 959, 960, 961, 963, 964, 967, 971, 975, 977, 978, 980, 981, 984, 985, 989, 991, 993, 995, 999 diff --git a/challenge_9/testfiles/t5 b/challenge_9/testfiles/t5 new file mode 100644 index 000000000..2e270c3f2 --- /dev/null +++ b/challenge_9/testfiles/t5 @@ -0,0 +1 @@ +-1000, -999, -995, -994, -982, -978, -973, -971, -966, -954, -952, -949, -947, -946, -928, -923, -922, -910, -907, -906, -900, -893, -892, -890, -888, -886, -877, -874, -868, -864, -861, -860, -852, -849, -839, -835, -829, -828, -827, -815, -814, -813, -811, -810, -809, -807, -805, -801, -797, -795, -791, -790, -785, -783, -782, -760, -756, -753, -750, -748, -744, -728, -723, -722, -717, -709, -705, -698, -696, -690, -689, -684, -682, -675, -668, -662, -658, -652, -651, -646, -639, -635, -634, -632, -630, -627, -620, -619, -617, -615, -613, -608, -593, -585, -582, -580, -576, -575, -574, -572, -558, -556, -533, -532, -508, -505, -502, -499, -494, -473, -460, -459, -457, -451, -445, -443, -437, -432, -431, -426, -424, -423, -419, -418, -413, -406, -402, -401, -393, -389, -387, -386, -385, -383, -382, -379, -376, -368, -366, -363, -361, -360, -313, -301, -297, -291, -288, -286, -284, -273, -263, -252, -244, -242, -239, -238, -233, -230, -211, -203, -182, -169, -166, -165, -163, -157, -152, -151, -149, -146, -140, -136, -134, -126, -125, -124, -105, -103, -88, -87, -84, -82, -78, -73, -71, -70, -68, -58, -56, -55, -46, -40, -39, -38, -25, -24, -22, -17, -10, -6, -1, 5, 18, 22, 26, 27, 28, 29, 37, 40, 42, 44, 50, 57, 65, 66, 72, 82, 89, 90, 93, 95, 98, 110, 114, 117, 125, 127, 128, 129, 130, 134, 137, 141, 145, 154, 156, 157, 165, 168, 170, 173, 174, 175, 177, 183, 184, 185, 186, 192, 193, 197, 206, 216, 223, 224, 226, 227, 229, 232, 237, 239, 247, 252, 253, 260, 266, 268, 269, 270, 280, 294, 295, 300, 303, 314, 315, 321, 322, 325, 327, 332, 334, 335, 349, 351, 363, 368, 373, 375, 395, 403, 416, 418, 422, 426, 434, 435, 436, 440, 441, 455, 460, 463, 465, 470, 473, 475, 478, 483, 486, 495, 497, 498, 499, 508, 520, 524, 525, 532, 534, 539, 543, 550, 554, 556, 562, 567, 574, 575, 576, 577, 593, 597, 599, 606, 608, 621, 625, 626, 630, 631, 637, 647, 661, 667, 679, 681, 695, 703, 713, 714, 717, 724, 726, 737, 739, 743, 745, 750, 765, 769, 784, 786, 790, 795, 799, 812, 814, 820, 821, 825, 832, 839, 841, 850, 851, 853, 857, 873, 876, 887, 889, 900, 906, 908, 910, 914, 930, 943, 944, 945, 946, 954, 955, 964, 977, 985, 989, 994 diff --git a/challenge_9/testfiles/t6 b/challenge_9/testfiles/t6 new file mode 100644 index 000000000..acabe2f80 --- /dev/null +++ b/challenge_9/testfiles/t6 @@ -0,0 +1 @@ +-999, -996, -995, -994, -990, -983, -977, -973, -972, -970, -969, -964, -960, -944, -942, -940, -934, -928, -926, -922, -920, -913, -909, -908, -892, -890, -869, -867, -866, -862, -860, -845, -836, -831, -830, -814, -810, -806, -804, -801, -799, -797, -796, -795, -793, -787, -785, -784, -783, -779, -774, -773, -766, -765, -761, -736, -727, -723, -719, -717, -716, -707, -705, -697, -692, -689, -688, -687, -684, -676, -674, -671, -668, -657, -647, -635, -623, -602, -601, -584, -582, -580, -569, -566, -565, -550, -549, -547, -543, -542, -536, -533, -523, -518, -508, -497, -492, -491, -485, -473, -472, -470, -460, -458, -449, -445, -440, -438, -432, -426, -420, -417, -410, -405, -386, -383, -380, -374, -372, -369, -367, -358, -356, -354, -345, -343, -342, -339, -338, -325, -322, -319, -313, -310, -302, -288, -286, -285, -280, -273, -272, -271, -263, -258, -255, -252, -251, -247, -245, -241, -224, -216, -210, -208, -188, -183, -181, -179, -175, -159, -156, -155, -150, -141, -137, -135, -132, -128, -126, -125, -124, -121, -119, -117, -112, -111, -107, -105, -104, -102, -88, -82, -79, -71, -64, -57, -55, -50, -41, -37, -36, -35, -26, -21, -17, -14, -11, -6, -4, 3, 8, 12, 14, 16, 18, 25, 27, 45, 46, 48, 65, 74, 75, 93, 96, 97, 102, 103, 107, 110, 132, 133, 143, 147, 150, 155, 166, 171, 172, 173, 180, 184, 192, 194, 195, 201, 206, 217, 218, 222, 224, 232, 248, 249, 255, 265, 269, 270, 275, 278, 284, 286, 288, 289, 292, 296, 298, 309, 314, 318, 319, 323, 333, 334, 338, 346, 348, 350, 366, 367, 375, 386, 387, 393, 395, 399, 403, 407, 415, 417, 418, 433, 439, 440, 446, 451, 458, 465, 467, 469, 478, 479, 483, 486, 497, 501, 502, 506, 511, 513, 515, 525, 529, 530, 541, 542, 548, 551, 561, 562, 563, 567, 576, 578, 589, 591, 593, 595, 597, 599, 601, 610, 623, 633, 634, 635, 640, 650, 653, 665, 667, 668, 670, 672, 681, 682, 683, 685, 688, 710, 715, 716, 718, 719, 721, 722, 723, 725, 729, 730, 735, 744, 747, 751, 762, 766, 769, 770, 771, 778, 781, 787, 791, 793, 798, 803, 807, 812, 818, 822, 834, 837, 839, 860, 863, 870, 875, 878, 879, 880, 883, 904, 907, 919, 927, 930, 931, 935, 939, 944, 951, 952, 957, 959, 965, 968, 974, 976, 987, 993 From 20cd28b13bf6c17309c96818c4f31de713615383 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 14:51:58 -0800 Subject: [PATCH 30/95] Update README.md --- challenge_9/README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/challenge_9/README.md b/challenge_9/README.md index 2f21201a6..1da1fd4ef 100644 --- a/challenge_9/README.md +++ b/challenge_9/README.md @@ -21,6 +21,20 @@ Notes Hint: There is no limit to the space complexity for this challenge. -Testing +[Testing](https://github.com/YearOfProgramming/2017Challenges#testing) ----- -Testing is rather straightforward. Simply create an array with/without negatives, 0 and positives, then feed it into your function and verify it by hand. \ No newline at end of file +Testing is rather straightforward. Simply create an array with/without negatives, 0 and positives, then feed it into your function and verify it by hand. + +######Test Script +Input: + + -2,-1,0,1,2 + +Output: + + 0 + 1 + 1 + 4 + 4 + From 740b4e9bcfd02013e467e8cabb73eebae7397a73 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 14:54:11 -0800 Subject: [PATCH 31/95] Update README.md --- challenge_9/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/challenge_9/README.md b/challenge_9/README.md index 1da1fd4ef..4fd7d9587 100644 --- a/challenge_9/README.md +++ b/challenge_9/README.md @@ -26,15 +26,16 @@ Hint: There is no limit to the space complexity for this challenge. Testing is rather straightforward. Simply create an array with/without negatives, 0 and positives, then feed it into your function and verify it by hand. ######Test Script + Input: - -2,-1,0,1,2 + -2,-1,0,1,2 Output: - 0 - 1 - 1 - 4 - 4 + 0 + 1 + 1 + 4 + 4 From c75004a01ce05c04a333b70dbc9c19adb00a8daf Mon Sep 17 00:00:00 2001 From: ning Date: Thu, 12 Jan 2017 11:15:07 +0800 Subject: [PATCH 32/95] Remove O(n^2) solutions, change all to fit O(n) solution --- challenge_7/python/ning/README.md | 11 ++---- challenge_7/python/ning/alt_test.py | 54 -------------------------- challenge_7/python/ning/challenge_7.py | 6 --- challenge_7/python/ning/time.py | 54 -------------------------- 4 files changed, 3 insertions(+), 122 deletions(-) delete mode 100644 challenge_7/python/ning/alt_test.py delete mode 100644 challenge_7/python/ning/time.py diff --git a/challenge_7/python/ning/README.md b/challenge_7/python/ning/README.md index c89c1e469..190c62c4d 100644 --- a/challenge_7/python/ning/README.md +++ b/challenge_7/python/ning/README.md @@ -1,10 +1,5 @@ # Challenge 7, Find The Missing Number -1. Our solution for challenge 7 comes in the form of a function `find_missing`, taking a paramter of list `input_list`. -2. We first create a set `input_set` from `input_list`. This is as it is faster to check if an element is in a set than in a list, in python. -3. We find the minimum and maximum of `input_list`, i.e. the range of the 'list of numbers from 0 to N-1'. -4. We iterate through this range from smallest to largest, checking for each integer if it exists in `input_set` (and therefore `input_list`). If it does not exist (i.e. is _missing_ from the `input_set`), return the integer. - -## Learning Points - -None so far. Which is suspicious, given that this is apparently a popular interview question. +1. Find the sum of all integers in the list given, `input_list`. +2. Find the sum of all integers between the minimum and maximum (i.e. range) of integers in the list given, `input_list`. +3. Find the difference between the two sums to get the missing integer. diff --git a/challenge_7/python/ning/alt_test.py b/challenge_7/python/ning/alt_test.py deleted file mode 100644 index 79bcc3d93..000000000 --- a/challenge_7/python/ning/alt_test.py +++ /dev/null @@ -1,54 +0,0 @@ -'''unit test for challenge 7 by ning -Feel free to make a copy under your -directory and use/modify as you like.''' - -import unittest -from challenge_7 import alt_find_missing - -class Tests(unittest.TestCase): - def test_small(self): - self.assertEqual( - alt_find_missing([0, 1, 3]), - 2 - ) - - def test_medium(self): - self.assertEqual( - alt_find_missing([0, 1, 2, 3, 4, 6, 7, 8, 9, 10]), - 5 - ) - - def test_large(self): - self.assertEqual( - alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]), - 21 - ) - - def test_larger(self): - self.assertEqual( - alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200]), - 125 - ) - - def test_negative(self): - self.assertEqual( - alt_find_missing([-10, -9, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), - -8 - ) - - def test_unsorted(self): - self.assertEqual( - alt_find_missing([4, 2, 1, 5, 0]), - 3 - ) - - def test_unsorted_negative(self): - self.assertEqual( - alt_find_missing([-5, 5, -4, 3, -3, 2, -2, 1, -1, 0]), - 4 - ) - - -if __name__ == '__main__': - unittest.main() - diff --git a/challenge_7/python/ning/challenge_7.py b/challenge_7/python/ning/challenge_7.py index 93400c1db..640dabb7e 100644 --- a/challenge_7/python/ning/challenge_7.py +++ b/challenge_7/python/ning/challenge_7.py @@ -1,10 +1,4 @@ def find_missing(input_list): - input_set = set(input_list) - for i in range(min(input_list), max(input_list)+1): - if i not in input_set: - return i - -def alt_find_missing(input_list): input_sum = sum(input_list) range_sum = sum([i for i in range(min(input_list), max(input_list)+1)]) return range_sum - input_sum diff --git a/challenge_7/python/ning/time.py b/challenge_7/python/ning/time.py deleted file mode 100644 index ce7d41043..000000000 --- a/challenge_7/python/ning/time.py +++ /dev/null @@ -1,54 +0,0 @@ -import timeit -from challenge_7 import find_missing, alt_find_missing - -print('List with 4 elements, using for ... in set (x 1 000 000)') -print(timeit.timeit( - stmt='find_missing([0, 1, 2, 4,])', - setup='from __main__ import find_missing', - number=1000000)) - -print('List with 4 elements, using difference of sums (x 1 000 000)') -print(timeit.timeit( - stmt='alt_find_missing([0, 1, 2, 4,])', - setup='from __main__ import alt_find_missing', - number=1000000)) - -print('List with 100 elements, using for ... in set (x 1 000 000)') -print(timeit.timeit( - stmt='find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])', - setup='from __main__ import find_missing', - number=1000000)) - -print('List with 100 elements, using difference of sums (x 1 000 000)') -print(timeit.timeit( - stmt='alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100])', - setup='from __main__ import alt_find_missing', - number=1000000)) - -print('List with 1000 elements, using for ... in set (x 100 000)') -print(timeit.timeit( - stmt='find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000])', - setup='from __main__ import find_missing', - number=100000)) - -print('List with 1000 elements, using difference of sums (x 100 000)') -print(timeit.timeit( - stmt='alt_find_missing([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000])', - setup='from __main__ import alt_find_missing', - number = 100000)) - -'''OUTPUT -List with 4 elements, using for ... in set (x 1 000 000) -1.1550223514080038 -List with 4 elements, using difference of sums (x 1 000 000) -1.391524411772641 -List with 100 elements, using for ... in set (x 1 000 000) -8.43574248785071 -List with 100 elements, using difference of sums (x 1 000 000) -8.94695660741872 -List with 1000 elements, using for ... in set (x 100 000) -8.1138781071155 -List with 1000 elements, using difference of sums (x 100 000) -8.383110816298519 -''' - From ae7ee55b324f91362632165c8a9d225672225546 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Wed, 11 Jan 2017 21:10:16 -0800 Subject: [PATCH 33/95] [C++] Challenge 7 (Unreviewed) (#343) * Challenge 7 C++ * new test * fixed testfiles and readme * cleaned testfiles * added comment to ch7 --- challenge_7/cpp/manuel/Makefile | 33 ++++++++++++++++++++ challenge_7/cpp/manuel/README.md | 24 +++++++++++++++ challenge_7/cpp/manuel/src/include/tools.h | 12 ++++++++ challenge_7/cpp/manuel/src/main.cpp | 27 ++++++++++++++++ challenge_7/cpp/manuel/src/tools.cpp | 36 ++++++++++++++++++++++ 5 files changed, 132 insertions(+) create mode 100644 challenge_7/cpp/manuel/Makefile create mode 100644 challenge_7/cpp/manuel/README.md create mode 100644 challenge_7/cpp/manuel/src/include/tools.h create mode 100644 challenge_7/cpp/manuel/src/main.cpp create mode 100644 challenge_7/cpp/manuel/src/tools.cpp diff --git a/challenge_7/cpp/manuel/Makefile b/challenge_7/cpp/manuel/Makefile new file mode 100644 index 000000000..308b926b7 --- /dev/null +++ b/challenge_7/cpp/manuel/Makefile @@ -0,0 +1,33 @@ +SRC := $(wildcard src/*.cpp) +HEADERS := $(wildcard $(addprefix src/include/, *.h)) + +OBJDIR := obj +BINDIR := bin +OBJECTS := $(addprefix $(OBJDIR)/, $(notdir src/ $(SRC:.cpp=.o))) + +EXE := solution.exe +CC := g++ +CFLAGS := -Wall -c -std=c++11 +LFLAGS := -Wall + +$(EXE) : $(BINDIR) $(OBJDIR) $(OBJECTS) + @$(CC) $(LFLAGS) -o $(BINDIR)/$@ $(OBJECTS) + +obj/%.o : src/%.cpp $(HEADERS) + @$(CC) $(CFLAGS) -o $@ $< + +.PHONY : clean test $(BINDIR) $(OBJDIR) + +clean : + @rm -rf $(BINDIR) $(OBJDIR) + +test: + @cd ../../../;\ + ./_bin/test 7 cpp manuel;\ + cd challenge_7/cpp/manuel/;\ + +$(BINDIR) : + @mkdir -p $(BINDIR) + +$(OBJDIR) : + @mkdir -p $(OBJDIR) diff --git a/challenge_7/cpp/manuel/README.md b/challenge_7/cpp/manuel/README.md new file mode 100644 index 000000000..5261ff4c2 --- /dev/null +++ b/challenge_7/cpp/manuel/README.md @@ -0,0 +1,24 @@ +# Challenge Name +###### C++11 @manuel + +### 1. Approch to Solving the problem + +Given a set of numbers ranging from 0 to N-1 with one missing number, +then the largest number in that set is the length of the array. + +If we find the sum of N + (N-1) + (N - 2) + ... + (N - N) = N * (N + 1) / 2, +and then iterate through the given set and subtract this value, once we +reach the end of the array the difference will be the missing number. + +### 2. How to compile and run this code + +``` +make +make test +make clean +``` + +### 3. How this program works + +Single line of input -> Single line of output + 1,3,4,0 -> 2 diff --git a/challenge_7/cpp/manuel/src/include/tools.h b/challenge_7/cpp/manuel/src/include/tools.h new file mode 100644 index 000000000..b1fabde30 --- /dev/null +++ b/challenge_7/cpp/manuel/src/include/tools.h @@ -0,0 +1,12 @@ +#ifndef TOOLS_H +#define TOOLS_H + +namespace tools { + + std::vector string_to_numbers (std::string); + int sum_of_n(int); + + +} + +#endif diff --git a/challenge_7/cpp/manuel/src/main.cpp b/challenge_7/cpp/manuel/src/main.cpp new file mode 100644 index 000000000..6b8318661 --- /dev/null +++ b/challenge_7/cpp/manuel/src/main.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +#include "include/tools.h" + +int main(int argc, char **argv) { + + std::string input; // stores string input + std::getline(std::cin, input); // get line from standard input + + // Convert string of numbers to array of numbers + std::vector numbers = tools::string_to_numbers(input); + + int length = numbers.size(); + + int missing_number = tools::sum_of_n(length); + + // Subtracting values until we get missing number + for(auto i: numbers) { + missing_number -= i; + } + + std::cout << missing_number << std::endl; + + return 0; +} diff --git a/challenge_7/cpp/manuel/src/tools.cpp b/challenge_7/cpp/manuel/src/tools.cpp new file mode 100644 index 000000000..a0e9d9b13 --- /dev/null +++ b/challenge_7/cpp/manuel/src/tools.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +#include "include/tools.h" + +namespace tools { + + std::vector string_to_numbers (std::string str) { + // Given a string "1,2,3,4,5" this outputs + // an array of integers [1,2,3,4,5] + + std::vector numbers; + std::stringstream ss(str); + int number; + + while ( ss >> number ) { + numbers.push_back(number); + + if(ss.peek() == ',') { + ss.ignore(); + } + } + + return numbers; + } + + int sum_of_n(int N) { + // N + (N- 1) + (N - 2) + ... + (N - N) + + return N * (N + 1) / 2; + } + +} + + From 32435b65fc00fae9b6fe60af86a3a8bf1b6c9978 Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Thu, 12 Jan 2017 14:22:16 +0900 Subject: [PATCH 34/95] [Haskell] Challenge 4 (#190) --- challenge_4/haskell/halogenandtoast/README.md | 39 +++++++++++++++++++ .../haskell/halogenandtoast/src/Challenge.hs | 8 ++++ .../haskell/halogenandtoast/src/Spec.hs | 24 ++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 challenge_4/haskell/halogenandtoast/README.md create mode 100644 challenge_4/haskell/halogenandtoast/src/Challenge.hs create mode 100644 challenge_4/haskell/halogenandtoast/src/Spec.hs diff --git a/challenge_4/haskell/halogenandtoast/README.md b/challenge_4/haskell/halogenandtoast/README.md new file mode 100644 index 000000000..a110d8148 --- /dev/null +++ b/challenge_4/haskell/halogenandtoast/README.md @@ -0,0 +1,39 @@ +# Invert Binary Tree + +## 1. Approach + +This problem is best represented as a recursive problem. Swap the left and right +branches and then recurse for each of these branches. In Haskell this is fairly +easy because I can pattern match on my tree typeI decided not to take in input +via STDIN due to representing a tree via STDIN being difficult. + +## 2. Running + +This challenge has no main function and instead you should run the tests + +## 3. Testing + +In order to run this you will need the `runhaskell` binary. Then you simply run + +`runhaskell Spec.hs` + +## 4. Overview of Code + +### Challenge.hs + +This is the core of the code and includes a type declaration and the function +`invert`. + +To represent our Tree we define a high kind of type (the Tree can wrap any other +type - thus Tree a) and can either be a recursive type Node a (Tree a) (Tree a) +or Empty, representing a terminal in our tree. + +`invert` will take a Tree and pattern match against it. If the tree is Empty, we +can return Empty. This is how our recursive function will terminate. If we +pattern match against a Node, it recreates the Node, swapping the left and right +branches and recursively calls invert on both of them. + +### Spec.hs + +This file contains a couple of simple tests to check that our `invert` functions +works as expected. diff --git a/challenge_4/haskell/halogenandtoast/src/Challenge.hs b/challenge_4/haskell/halogenandtoast/src/Challenge.hs new file mode 100644 index 000000000..ad81e7870 --- /dev/null +++ b/challenge_4/haskell/halogenandtoast/src/Challenge.hs @@ -0,0 +1,8 @@ +module Challenge where + +data Tree a = Node a (Tree a) (Tree a) | Empty + deriving (Show, Eq) + +invert :: Tree a -> Tree a +invert Empty = Empty +invert (Node v l r) = Node v (invert r) (invert l) diff --git a/challenge_4/haskell/halogenandtoast/src/Spec.hs b/challenge_4/haskell/halogenandtoast/src/Spec.hs new file mode 100644 index 000000000..3f0985e38 --- /dev/null +++ b/challenge_4/haskell/halogenandtoast/src/Spec.hs @@ -0,0 +1,24 @@ +module Spec where + +import Test.Hspec +import Challenge + +main :: IO () +main = hspec $ do + describe "Chalenge.invert" $ do + it "returns Empty when Empty" $ do + invert Empty `shouldBe` (Empty :: Tree Int) + + it "returns the root node when it is the only node" $ do + let example = Node 1 Empty Empty + invert example `shouldBe` example + + it "swaps the branches" $ do + let example = Node 1 (Node 2 Empty Empty) (Node 3 Empty Empty) + let expected = Node 1 (Node 3 Empty Empty) (Node 2 Empty Empty) + invert example `shouldBe` expected + + it "swaps the branches recursively" $ do + let example = Node 1 (Node 2 (Node 3 Empty (Node 4 Empty Empty)) Empty) (Node 5 (Node 6 Empty (Node 7 Empty Empty)) Empty) + let expected = Node 1 (Node 5 Empty (Node 6 (Node 7 Empty Empty) Empty)) (Node 2 Empty (Node 3 (Node 4 Empty Empty) Empty)) + invert example `shouldBe` expected From 713769a70e2a6738c29a8618cbc6192a0ea23452 Mon Sep 17 00:00:00 2001 From: Shivam Shukla Date: Thu, 12 Jan 2017 16:06:27 +0530 Subject: [PATCH 35/95] [Go] Challenge 0 --- challenge_0/go/shivams/README.md | 10 ++++++++++ challenge_0/go/shivams/hello.go | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 challenge_0/go/shivams/README.md create mode 100644 challenge_0/go/shivams/hello.go diff --git a/challenge_0/go/shivams/README.md b/challenge_0/go/shivams/README.md new file mode 100644 index 000000000..d918eed97 --- /dev/null +++ b/challenge_0/go/shivams/README.md @@ -0,0 +1,10 @@ +## Hello world! +#### To run the code : +* Install [golgang](https://golang.org/doc/install) +* Open this directory in terminal. +* Set GOPATH environment variable to path of this directory. +* Run `go run helloworld.go` to compile and run the code. +``` +$ go run helloworld.go +Hello World! +``` diff --git a/challenge_0/go/shivams/hello.go b/challenge_0/go/shivams/hello.go new file mode 100644 index 000000000..c698732c5 --- /dev/null +++ b/challenge_0/go/shivams/hello.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello World") +} From bebba7c786858dfa54a48c1b0c75c9dca90d5930 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Thu, 12 Jan 2017 19:59:49 +0300 Subject: [PATCH 36/95] [Python] Challenge 3 (Unreviewed) (#357) * challenge 3 in python * Challenge 3 in python #2 (Whoops) --- challenge_3/python/sarcodian/README.md | 8 ++++++++ challenge_3/python/sarcodian/src/challenge_3.py | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 challenge_3/python/sarcodian/README.md create mode 100644 challenge_3/python/sarcodian/src/challenge_3.py diff --git a/challenge_3/python/sarcodian/README.md b/challenge_3/python/sarcodian/README.md new file mode 100644 index 000000000..b3f766ef9 --- /dev/null +++ b/challenge_3/python/sarcodian/README.md @@ -0,0 +1,8 @@ +Majority Element +Premise + + Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. + + You may assume that the array is non-empty and the majority element always exist in the array. + +for example, given array = [2,2,3,7,5,7,7,7,4,7,2,7,4,5,6,7,7,8,6,7,7,8,10,12,29,30,19,10,7,7,7,7,7,7,7,7,7] your program should return 7 \ No newline at end of file diff --git a/challenge_3/python/sarcodian/src/challenge_3.py b/challenge_3/python/sarcodian/src/challenge_3.py new file mode 100644 index 000000000..afa12b82e --- /dev/null +++ b/challenge_3/python/sarcodian/src/challenge_3.py @@ -0,0 +1,9 @@ +def majority(array0): + store = {} + for i in array0: + store[i] = store.get(i,0) + 1 + + for i in store.keys(): + if store[i] > len(array0)//2: + return i + print('No majority found') From 031a1f76cb92675196dbf7a106d4cc8e6b1f68f1 Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Thu, 12 Jan 2017 19:30:20 -0500 Subject: [PATCH 37/95] added challenge 12 --- challenge_12/README.md | 19 +++++++ challenge_12/python/slandau3/compression.py | 59 +++++++++++++++++++++ challenge_12/python/slandau3/tests.py | 52 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 challenge_12/README.md create mode 100644 challenge_12/python/slandau3/compression.py create mode 100644 challenge_12/python/slandau3/tests.py diff --git a/challenge_12/README.md b/challenge_12/README.md new file mode 100644 index 000000000..126ab364d --- /dev/null +++ b/challenge_12/README.md @@ -0,0 +1,19 @@ +Compression and Decompression I +====== +Idea +------ +No doubt you've heard the word "compression" before. Compression is a massive concept in computing and crucial for transferring large files quickly. A lot of popular file transfer services don't even let you transfer something if it's not in a .zip file these days. + +Your job today is to create a program capable of doing two things. Compressing strings and decompressing them. Your program only needs to be able to handle text so don't worry about binary. Your "compress" method will take in a string and scan it for characters in tandem with the same character. Anytime you encounter a sequence of 4 or more identical characters all but one of those characters should be replaced with #[num of characters]. For example 'aaaaa' has 5 a's. Our compression function would turn that string into 'a#5'. + +As for decompressing, your program needs to be capable of uncompressing the compressed string. + +Notes +* The input will never be empty +* The input can consist of any (printable) character +* The input can be of any length +* You may not be able to compress the input at all, ex: 'abc' + +Testing +----- +Testing for this program is fairly straight forward. Simply think of a few strings, some that can be compressed, some that can't and feed it into your compression function. Once you have verified that it is compressed correctly, feed it into your decompress function. All you have to do now is compare the output of the decompressed function with the initial string and you will have your answer as to whether or not it decompressed properly. \ No newline at end of file diff --git a/challenge_12/python/slandau3/compression.py b/challenge_12/python/slandau3/compression.py new file mode 100644 index 000000000..4253498f9 --- /dev/null +++ b/challenge_12/python/slandau3/compression.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +import re + +COMPRESSION_CUTOFF = 3 + + +def compress(string_to_compress: str) -> str: + output = "" # The compressed string that will be outputted + character = "" # character the string_to_compress at blank + occurrences = 0 # the number of occurrences of this letter + for index, char in enumerate(string_to_compress): # goes through both the range and the characters at the same time + if char != character or index == len(string_to_compress)-1: # if we spot a different character, + # or are at the end of the string_to_compress + # go here + if index == len(string_to_compress)-1 and character == char: # If we are at the end of + # the string_to_compress + # but the last character is the same, add to the occurrences of the character + occurrences += 1 + + if occurrences > COMPRESSION_CUTOFF: + # If we have more than three occurrences, add the compress format to the output + output += character + '#' + str(occurrences) + else: + # the next line puts 'occurrences' number of 'character' in the output + output += character * occurrences + + if index == len(string_to_compress)-1 and character != char: + # If we are at the end of the string_to_compress and the character + # is not the same as the last. Top it off + output += char + + character = char # set char to character so we know the last character we looked at + occurrences = 1 + + else: + occurrences += 1 + + return output + + +def decompress(string_to_uncompress: str) -> str: + # Using regular expressions to parse the string_to_uncompress + matches = re.findall(r'(.#\d+)', string_to_uncompress) # Looking for [anything]#[at least one number] + decompressed = string_to_uncompress # decompressed is the new string that we will output + for match in matches: # Scan through the matches and uncompress each of them + # match the character so we know what character we need to expand + char = re.match(r'(.)#\d+', match) + # Determine the number of times it occurred + times = re.search(r'(\d+)', match) + + replacement = char.group(1) * int(times.group(1)) # To get the matches specifically we need to access + # them at group 1 + decompressed = decompressed.replace(match, replacement) + + return decompressed + + +print(decompress(compress("aaaaaaaa"))) diff --git a/challenge_12/python/slandau3/tests.py b/challenge_12/python/slandau3/tests.py new file mode 100644 index 000000000..5168ccf79 --- /dev/null +++ b/challenge_12/python/slandau3/tests.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import unittest +from compression import compress, decompress + +class Test(unittest.TestCase): + + def test1(self): + """ + A small standard string + :return: + """ + self.assertEqual(compress('aaaaa'), 'a#5') + + def test2(self): + """ + An arbitrarily long string + :return: + """ + self.assertEqual(compress('abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj'), "abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj") + + def test3(self): + """ + A string where a lot has to be compressed + :return: + """ + self.assertEqual(compress('kkkkkkjjjjjjjnnnnniiiiiiiooooook'), 'k#6j#7n#5i#7o#6k') + + def test4(self): + """ + Decompressing a small string + :return: + """ + self.assertEqual(decompress('a#5'), 'aaaaa') + + def test5(self): + """ + Decompress a fairly large string without too many compressions in it. + :return: + """ + self.assertEqual(decompress('abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj'), 'abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj') + + def test6(self): + """ + Decompress a string with a lot of compressions in it + :return: + """ + self.assertEqual(decompress('k#6j#7n#5i#7o#6k'), 'kkkkkkjjjjjjjnnnnniiiiiiiooooook') + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From dd41634d6d87e234b62c0ae7c21172066c9c918c Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Thu, 12 Jan 2017 20:34:59 -0500 Subject: [PATCH 38/95] Removed the possibility of a test case --- challenge_12/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/challenge_12/README.md b/challenge_12/README.md index 126ab364d..da523d420 100644 --- a/challenge_12/README.md +++ b/challenge_12/README.md @@ -13,7 +13,8 @@ Notes * The input can consist of any (printable) character * The input can be of any length * You may not be able to compress the input at all, ex: 'abc' +* The string being compressed will never contain '#' Testing ----- -Testing for this program is fairly straight forward. Simply think of a few strings, some that can be compressed, some that can't and feed it into your compression function. Once you have verified that it is compressed correctly, feed it into your decompress function. All you have to do now is compare the output of the decompressed function with the initial string and you will have your answer as to whether or not it decompressed properly. \ No newline at end of file +Testing for this program is fairly straight forward. Simply think of a few strings, some that can be compressed, some that can't and feed it into your compression function. Once you have verified that it is compressed correctly, feed it into your decompress function. All you have to do now is compare the output of the decompressed function with the initial string and you will have your answer as to whether or not it decompressed properly. From c752cd1b9e5687d40b332f0582ef9db3a9949934 Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Thu, 12 Jan 2017 20:37:21 -0500 Subject: [PATCH 39/95] Input is now only alphabetic --- challenge_12/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/challenge_12/README.md b/challenge_12/README.md index da523d420..19e80ea37 100644 --- a/challenge_12/README.md +++ b/challenge_12/README.md @@ -10,10 +10,9 @@ As for decompressing, your program needs to be capable of uncompressing the comp Notes * The input will never be empty -* The input can consist of any (printable) character +* The input can consist of any alphabetic characters (no ints or specials) * The input can be of any length * You may not be able to compress the input at all, ex: 'abc' -* The string being compressed will never contain '#' Testing ----- From 7945630af702b73a077f793fd4e323a43af68cb9 Mon Sep 17 00:00:00 2001 From: mindm Date: Fri, 13 Jan 2017 06:46:11 +0200 Subject: [PATCH 40/95] [Python] Challenge 11 added (#383) --- challenge_11/python/mindm/README.md | 8 ++ challenge_11/python/mindm/src/btree.py | 136 ++++++++++++++++++ .../python/mindm/src/remove_from_tree.py | 33 +++++ 3 files changed, 177 insertions(+) create mode 100644 challenge_11/python/mindm/README.md create mode 100644 challenge_11/python/mindm/src/btree.py create mode 100644 challenge_11/python/mindm/src/remove_from_tree.py diff --git a/challenge_11/python/mindm/README.md b/challenge_11/python/mindm/README.md new file mode 100644 index 000000000..9cdee7667 --- /dev/null +++ b/challenge_11/python/mindm/README.md @@ -0,0 +1,8 @@ +# Challenge_11 +## Remove Node from BST +This program creates a BST from your input and then removes nodes from it. + +You can run it with: +``` +$ python3 remove_from_tree.py +``` diff --git a/challenge_11/python/mindm/src/btree.py b/challenge_11/python/mindm/src/btree.py new file mode 100644 index 000000000..672e5937a --- /dev/null +++ b/challenge_11/python/mindm/src/btree.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + + +class BTree: + def __init__(self, value=None): + if value: + self.root = Node(value) + else: + self.root = None + + def get_root(self): + return self.root + + def pivot(self): + self.root.pivot() + + def tree_print(self): + self.root.tree_print() + + def insert(self, value): + if self.root: + self.root.insert(value) + else: + self.root = Node(value) + + def pre_print(self): + self.root.pre_print() + + def remove(self, value): + self.root = self.root.search_remove(value) + + +class Node: + def __init__(self, value, left=None, right=None): + self.value = value + self.left = left + self.right = right + + def find_smallest(self): + if self.left: + return self.left.find_smallest() + else: + return self.value + + def find_largest(self): + if self.right: + return self.right.find_largest() + else: + return self.value + + def search_remove(self, value): + """ Removes a vlue from the tree + """ + if value < self.value: + self.left = self.left.search_remove(value) + elif value > self.value: + self.right = self.right.search_remove(value) + else: + if self.right is None and self.left is not None: + return self.left + if self.left is None and self.right is not None: + return self.right + if self.left is None and self.right is None: + return None + self.value = self.left.find_largest() + self.left = self.left.search_remove(self.value) + return self + + def insert(self, value): + """ Insert node in BST + """ + if value < self.value: + self.pass_left(value) + else: + self.pass_right(value) + + def pass_left(self, value): + if self.left is not None: + self.left.insert(value) + else: + self.left = Node(value) + + def pass_right(self, value): + if self.right is not None: + self.right.insert(value) + else: + self.right = Node(value) + + def tree_print(self, indent=0): + """ Prints the tree hierarchically on the command line + """ + print("{}{}".format(' ' * indent, str(self.value))) + if self.left: + self.left.tree_print(indent+1) + else: + print("{}{}".format(' ' * (indent+1), "-")) + if self.right: + self.right.tree_print(indent+1) + else: + print("{}{}".format(' ' * (indent+1), "-")) + + def pre_print(self): + """ Prints tree in pre-order + """ + print(self.value) + if self.left: + self.left.pre_print() + if self.right: + self.right.pre_print() + + def depth(self): + """ Calculate the max depth of the tree + """ + if self.left is None and self.right is None: + return 1 + elif self.left is None: + return 1 + self.right.depth() + elif self.right is None: + return 1 + self.left.depth() + else: + return 1 + max(self.left.depth(), self.right.depth()) + + +def flip_tree(node): + """ Flips the tree by pivoting the children from bottom to top + """ + # Get the root node of tree, only executes once + if hasattr(node, "root"): + node = node.get_root() + + if node.left: + flip_tree(node.left) + if node.right: + flip_tree(node.right) + node.left, node.right = node.right, node.left diff --git a/challenge_11/python/mindm/src/remove_from_tree.py b/challenge_11/python/mindm/src/remove_from_tree.py new file mode 100644 index 000000000..f855fed65 --- /dev/null +++ b/challenge_11/python/mindm/src/remove_from_tree.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import sys +from btree import BTree + + +def insertion(args): + + tree = BTree() + + for value in args.strip().split(" "): + tree.insert(value) + + return tree + + +def deletion(tree, args): + + for value in args.strip().split(" "): + tree.remove(value) + + return tree + + +if __name__ == "__main__": + + args_insert = input("Insert nodes with spaces: ") + tree = insertion(args_insert) + tree.tree_print() + + args_delete = input("Which values to delete?: ") + tree = deletion(tree, args_delete) + tree.tree_print() From d6bf9e754dd8e13f196bfb4f5133f3cbfdd08092 Mon Sep 17 00:00:00 2001 From: rbrtdambrosio Date: Fri, 13 Jan 2017 06:36:21 +0100 Subject: [PATCH 41/95] [C++] Challenge 0 (Unreviewed) (#387) --- challenge_0/cpp/rbrt/README.md | 2 ++ challenge_0/cpp/rbrt/src/[C++] Challenge0.cpp | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 challenge_0/cpp/rbrt/README.md create mode 100644 challenge_0/cpp/rbrt/src/[C++] Challenge0.cpp diff --git a/challenge_0/cpp/rbrt/README.md b/challenge_0/cpp/rbrt/README.md new file mode 100644 index 000000000..543fab72f --- /dev/null +++ b/challenge_0/cpp/rbrt/README.md @@ -0,0 +1,2 @@ +challenge 0: Hello World + diff --git a/challenge_0/cpp/rbrt/src/[C++] Challenge0.cpp b/challenge_0/cpp/rbrt/src/[C++] Challenge0.cpp new file mode 100644 index 000000000..a8eec0ac2 --- /dev/null +++ b/challenge_0/cpp/rbrt/src/[C++] Challenge0.cpp @@ -0,0 +1,7 @@ +#include +using namespace std; + +int main(){ + cout<<"Hello world!"< Date: Fri, 13 Jan 2017 06:41:58 +0100 Subject: [PATCH 42/95] [c++] Challenge 1 (Unreviewed) (#388) --- challenge_1/cpp/rbrt/README.md | 3 ++ challenge_1/cpp/rbrt/src/[C++]Challenge1.cpp | 43 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 challenge_1/cpp/rbrt/README.md create mode 100644 challenge_1/cpp/rbrt/src/[C++]Challenge1.cpp diff --git a/challenge_1/cpp/rbrt/README.md b/challenge_1/cpp/rbrt/README.md new file mode 100644 index 000000000..f48293232 --- /dev/null +++ b/challenge_1/cpp/rbrt/README.md @@ -0,0 +1,3 @@ +The code works using inky the iostream library. +It works for input from the command line (multiple strings) +as well as run time input (single string). \ No newline at end of file diff --git a/challenge_1/cpp/rbrt/src/[C++]Challenge1.cpp b/challenge_1/cpp/rbrt/src/[C++]Challenge1.cpp new file mode 100644 index 000000000..3d304a5c1 --- /dev/null +++ b/challenge_1/cpp/rbrt/src/[C++]Challenge1.cpp @@ -0,0 +1,43 @@ +#include + +// I tried to solve this challenge using only the library + +using namespace std; + +int main(int argc, char* argv[]) +{ + // First we check inputs from the command line + // if there are no strings from the command line + // we wait for a string as input. + // The control (if) is don on the variable argv[1] + // argv[0] is reserved to the name of the program + + // In both cases the output is generated using a for loop. + // The starting point for reading the string, i.e. its end, + // is obtained with the function strlen() + + if (argv[1]!=NULL) + { + for (int i = argc - 1; i > 0; --i) + { + for (int j=strlen(argv[i]);j>=0;j--) + { + cout << argv[i][j]; + } + cout <> "; + cin>>x; + + for (int j=strlen(x);j>=0;j--) + { + cout << x[j]; + } + cout< Date: Thu, 12 Jan 2017 22:48:51 -0800 Subject: [PATCH 43/95] [C++] Challenge 9 (Unreviewed) (#378) * challenge 9 completed * added comments * Added missing comments --- challenge_9/cpp/manuel/Makefile | 33 ++++++++ challenge_9/cpp/manuel/README.md | 43 +++++++++++ challenge_9/cpp/manuel/src/include/tools.h | 10 +++ challenge_9/cpp/manuel/src/main.cpp | 27 +++++++ challenge_9/cpp/manuel/src/tools.cpp | 90 ++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 challenge_9/cpp/manuel/Makefile create mode 100644 challenge_9/cpp/manuel/README.md create mode 100644 challenge_9/cpp/manuel/src/include/tools.h create mode 100644 challenge_9/cpp/manuel/src/main.cpp create mode 100644 challenge_9/cpp/manuel/src/tools.cpp diff --git a/challenge_9/cpp/manuel/Makefile b/challenge_9/cpp/manuel/Makefile new file mode 100644 index 000000000..36e139277 --- /dev/null +++ b/challenge_9/cpp/manuel/Makefile @@ -0,0 +1,33 @@ +SRC := $(wildcard src/*.cpp) +HEADERS := $(wildcard $(addprefix src/include/, *.h)) + +OBJDIR := obj +BINDIR := bin +OBJECTS := $(addprefix $(OBJDIR)/, $(notdir src/ $(SRC:.cpp=.o))) + +EXE := solution.exe +CC := g++ +CFLAGS := -Wall -c -std=c++11 +LFLAGS := -Wall + +$(EXE) : $(BINDIR) $(OBJDIR) $(OBJECTS) + @$(CC) $(LFLAGS) -o $(BINDIR)/$@ $(OBJECTS) + +obj/%.o : src/%.cpp $(HEADERS) + @$(CC) $(CFLAGS) -o $@ $< + +.PHONY : clean test $(BINDIR) $(OBJDIR) + +clean : + @rm -rf $(BINDIR) $(OBJDIR) + +test: + @cd ../../../;\ + ./_bin/test 9 cpp manuel;\ + cd challenge_9/cpp/manuel/;\ + +$(BINDIR) : + @mkdir -p $(BINDIR) + +$(OBJDIR) : + @mkdir -p $(OBJDIR) diff --git a/challenge_9/cpp/manuel/README.md b/challenge_9/cpp/manuel/README.md new file mode 100644 index 000000000..58964ec59 --- /dev/null +++ b/challenge_9/cpp/manuel/README.md @@ -0,0 +1,43 @@ +# Squares +###### C++11 @manuel + +### 1. Approach to Solving the problem + +First I iterate through the given set of numbers and square all +the negative until I reach the numbers that are greater than or +equal to 0. + +At this point I have the length of the left side of the array, +and I know the right side by subtracting the length of the +given set minus the length of the left side. + +I then square the first index of the right side and compare to the +last index of the left side of the array, and insert the smallest +one into a new array. + +I then either decrement or increment depending on which one +was smaller. + +This will sort all the values in one pass, or slightly greater. + +### 2. How to compile and run this code + +``` +make +make test +make clean +``` + +### 3. How this program works + +Single line of input: + + -1,0,-1,2,3 + +Output: + + 0 + 1 + 1 + 4 + 9 diff --git a/challenge_9/cpp/manuel/src/include/tools.h b/challenge_9/cpp/manuel/src/include/tools.h new file mode 100644 index 000000000..354200b6f --- /dev/null +++ b/challenge_9/cpp/manuel/src/include/tools.h @@ -0,0 +1,10 @@ +#ifndef TOOLS_H +#define TOOLS_H + +namespace tools { + + std::vector string_to_numbers(std::string); + std::vector sort_squares(std::vector); +} + +#endif diff --git a/challenge_9/cpp/manuel/src/main.cpp b/challenge_9/cpp/manuel/src/main.cpp new file mode 100644 index 000000000..d234470a0 --- /dev/null +++ b/challenge_9/cpp/manuel/src/main.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +#include "include/tools.h" + +int main(int argc, char **argv) { + + // Get input + std::string input; + // Store string of numbers + std::getline(std::cin, input); + + // Convert string of numbers to array + std::vector numbers = tools::string_to_numbers(input); + // Apply aglorithm + std::vector sorted = tools::sort_squares(numbers); + + for(auto i: sorted) { + std::cout << i << std::endl; + } + + return 0; +} + + diff --git a/challenge_9/cpp/manuel/src/tools.cpp b/challenge_9/cpp/manuel/src/tools.cpp new file mode 100644 index 000000000..e4b9587cf --- /dev/null +++ b/challenge_9/cpp/manuel/src/tools.cpp @@ -0,0 +1,90 @@ +#include +#include +#include +#include +#include + +#include "include/tools.h" + +std::vector tools::string_to_numbers(std::string input) { + // Given a string "1,2,3,4,5" this outputs + // an array of integers [1,2,3,4,5] + std::stringstream ss(input); + std::vector numbers; + int number; + + while(ss >> number) { + numbers.push_back(number); + + if(ss.peek() == ',') { + ss.ignore(); + } + } + + return numbers; +} + +std::vector tools::sort_squares(std::vector numbers) { + // Will square the values of a sorted array and resport in O(N) + int length = numbers.size(); + + std::vector sorted; + int left_length = 0; + int right_length = length; + + // Square left side values of array first + for(int i = 0; numbers[i] < 0; i++) { + left_length++; + right_length--; + + numbers[i] = pow(numbers[i], 2); + } + + int left_index = left_length - 1; + int right_index = left_length; + bool squared = false; // Checks if this value has been squared + + // Compare both sides of array and insert accordingly + while(right_length > 0 && left_length > 0) { + + // Cotntinue squaring only if right index increments + if(!squared) { + numbers[right_index] = pow(numbers[right_index], 2); // continue squaring + squared = true; + } + + // If next right index is smaller insert, otherwise + // insert the left one + if(numbers[right_index] <= numbers[left_index]) { + sorted.push_back(numbers[right_index]); + right_index++; + right_length--; + squared = false; + } else { + sorted.push_back(numbers[left_index]); + left_index--; + left_length--; + } + } + + // Simply insert the last numbers of the longer side of the array + + // If the right array was longer, then insert the rest in order + while(right_length > 0) { + numbers[right_index] = pow(numbers[right_index], 2); + sorted.push_back(numbers[right_index]); + right_index++; + right_length--; + } + + // If the left array was longer, then insert the rest in order + while(left_length > 0 ) { + sorted.push_back(numbers[left_index]); + left_index--; + left_length--; + } + + return sorted; +} + + From 5e84dd3420ba32f23a704682b38ace4792dd0bcc Mon Sep 17 00:00:00 2001 From: ningOTI Date: Sat, 14 Jan 2017 23:20:57 +0800 Subject: [PATCH 44/95] Challenge #0: Add solution in bash (#398) --- challenge_0/bash/ning/README.md | 7 +++++++ challenge_0/bash/ning/challenge_0.sh | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 challenge_0/bash/ning/README.md create mode 100644 challenge_0/bash/ning/challenge_0.sh diff --git a/challenge_0/bash/ning/README.md b/challenge_0/bash/ning/README.md new file mode 100644 index 000000000..d888f0831 --- /dev/null +++ b/challenge_0/bash/ning/README.md @@ -0,0 +1,7 @@ +#Challenge #0, Hello World + +This script echoes 'Hello world!'. + +## Learning Points + +You gotta execute batch scripts with a preceding `./`, yo. diff --git a/challenge_0/bash/ning/challenge_0.sh b/challenge_0/bash/ning/challenge_0.sh new file mode 100644 index 000000000..485e2f637 --- /dev/null +++ b/challenge_0/bash/ning/challenge_0.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello world!" From a5dec1308f3121f2b54179dbbdecfca05c1b1623 Mon Sep 17 00:00:00 2001 From: D Davis Date: Sat, 14 Jan 2017 17:03:10 -0500 Subject: [PATCH 45/95] [Python] Challenge 0 (Unreviewed) (#400) --- challenge_0/python/dfdx2/hello.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge_0/python/dfdx2/hello.py diff --git a/challenge_0/python/dfdx2/hello.py b/challenge_0/python/dfdx2/hello.py new file mode 100644 index 000000000..ad35e5ae3 --- /dev/null +++ b/challenge_0/python/dfdx2/hello.py @@ -0,0 +1 @@ +print("Hello World") From e97b93fa5edea741ead7ae01dcbe6d4cedfc5ad5 Mon Sep 17 00:00:00 2001 From: erocs Date: Sat, 14 Jan 2017 17:30:02 -0800 Subject: [PATCH 46/95] Licensing (#401) --- CONTRIBUTING.md | 1 + LICENSE.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ NOTICE | 3 +++ 3 files changed, 61 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.md create mode 100644 NOTICE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..784851b25 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +All contributers must aggree to the CLA (Contributer License Agreement) located at https://gist.github.com/ManuelMeraz/46768d12d886f39e916663854aa75501 before submissions will be accepted. The service at https://cla-assistant.io is used to track CLA acceptance. For your first pull request and for any updates to the CLA, the service will have you agree to the current CLA as part of the pull request. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..6f44a9dee --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,57 @@ +The contents of this repository, named 2017Challenges and officially hosted at https://github.com/YearOfProgramming/2017Challenges, is licensed under the Apache 2.0 License. The current license text is found at https://www.apache.org/licenses/LICENSE-2.0. The license as of 2017-January-14 is copied below for your convience. + +--- + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of this License; and +You must cause any modified files to carry prominent notices stating that You changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..4804f9c0c --- /dev/null +++ b/NOTICE @@ -0,0 +1,3 @@ +This code has been contributed to https://github.com/YearOfProgramming/2017Challenges +for academic purposes. There are no guarantees of any form and it is reasonable to +expect that any code here is non-functional or incorrect. From 517ce6b11ab4e83b1b477bd5f0657bf0c78efab6 Mon Sep 17 00:00:00 2001 From: erocs Date: Sat, 14 Jan 2017 18:19:59 -0800 Subject: [PATCH 47/95] Delete LICENSE.txt --- LICENSE.txt | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 8a631f24e..000000000 --- a/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 2017 Year of Programming - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. From 70e6f56166813551759db314bac7cdbe292cb5ae Mon Sep 17 00:00:00 2001 From: ningOTI Date: Sun, 15 Jan 2017 22:20:34 +0800 Subject: [PATCH 48/95] Challenge #10: Add solution in python (#397) --- challenge_10/python/ning/README.md | 25 ++++++++++ challenge_10/python/ning/challenge_10.py | 39 +++++++++++++++ challenge_10/python/ning/test.py | 60 ++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 challenge_10/python/ning/README.md create mode 100644 challenge_10/python/ning/challenge_10.py create mode 100644 challenge_10/python/ning/test.py diff --git a/challenge_10/python/ning/README.md b/challenge_10/python/ning/README.md new file mode 100644 index 000000000..192fda4f2 --- /dev/null +++ b/challenge_10/python/ning/README.md @@ -0,0 +1,25 @@ +# Challenge #10, Valid Closers + +I found three cases where the sequence can be considered to have 'invalid closers'. + +1. A mismatch in the number of opening and closing brackets, e.g. `())` +2. Premature closing, e.g. `][` +3. Overlapping of brackets, e.g. `([<)]>` + +In this solution, we use a list to 'count' the brackets as we iterate through the list. Every opening bracket adds to this list `mem`, and closing brackets remove their corresponding openings from the list. + +The first invalid case is partially tested for by checking if the list `mem` is empty at the end of the iteration. The works for an abundance, but not shortage of opening brackets. + +For the case whereby there is a shortage of closing brackets, we simply return False in the case of an `IndexError`. This also covers the second case of premature closing. + +For the third case of overlapping, we check for every closing bracket if the most recent _unclosed_ opening bracket is of the same type. If not, False is returned as expected. + +The unit test, `test.py`, is constructed simply from the examples given. + +``` +......... +---------------------------------------------------------------------- +Ran 9 tests in 0.001s + +OK +``` diff --git a/challenge_10/python/ning/challenge_10.py b/challenge_10/python/ning/challenge_10.py new file mode 100644 index 000000000..2869730cd --- /dev/null +++ b/challenge_10/python/ning/challenge_10.py @@ -0,0 +1,39 @@ +def check_close(input_string): + OPENS = ('(', '<', '[', '{') + CLOSES = (')', '>', ']', '}') + PAREN = ('(', ')') + ANGLE = ('<', '>') + SQUARE = ('[', ']') + CURLY = ('{', '}') + mem = [] + + for character in input_string: + try: + if character in OPENS: + mem.append(character) + elif character in CLOSES: + if (character in PAREN and + mem[-1] in PAREN): + del mem[-1] + elif (character in ANGLE and + mem[-1] in ANGLE): + del mem[-1] + elif (character in SQUARE and + mem[-1] in SQUARE): + del mem[-1] + elif (character in CURLY and + mem[-1] in CURLY): + del mem[-1] + else: + return False + except IndexError: + return False + + if mem == []: + return True + else: + return False + +if __name__ == '__main__': + while True: + print(check_close(input(' >>> '))) diff --git a/challenge_10/python/ning/test.py b/challenge_10/python/ning/test.py new file mode 100644 index 000000000..dc73c228b --- /dev/null +++ b/challenge_10/python/ning/test.py @@ -0,0 +1,60 @@ +import unittest +from challenge_10 import check_close + +class Tests(unittest.TestCase): + def test_1(self): + self.assertEqual( + check_close('{{{{{{{{{adfkjaefia}}}}}}}'), + False + ) + + def test_2(self): + self.assertEqual( + check_close('{{{{{{{{{[[[[[[kadfa{{{{{{{((({daljfdaf({{{[]}}kaldjfs})})))}}}}}}}]]]]]]}kjfela}}}}}}}}'), + True + ) + + def test_3(self): + self.assertEqual( + check_close('{{{[}}}}dafda'), + False + ) + + def test_4(self): + self.assertEqual( + check_close('{{{{{{{{{}}}}}}}}}'), + True + ) + + def test_5(self): + self.assertEqual( + check_close('[[[[[[[[[kafjalfeianfailfeja;fjai;efa;sfj]]]]]]]]]kjajdain'), + True + ) + + def test_6(self): + self.assertEqual( + check_close('< blank >'), + True + ) + + def test_7(self): + self.assertEqual( + check_close('((((((fjdalfeja((((alefjalisj(())))))))))))d'), + True + ) + + def test_8(self): + self.assertEqual( + check_close(')))(((d'), + False + ) + + def test_9(self): + self.assertEqual( + check_close('({)}'), + False + ) + +if __name__ == '__main__': + unittest.main() From ab44ef942c6bb342529b037ecaf5470872d8a2fb Mon Sep 17 00:00:00 2001 From: x95 Date: Mon, 16 Jan 2017 00:04:22 +0100 Subject: [PATCH 49/95] [x86] Challenge 4 (ReadyForMerge) (#405) * challenge_1 in x86asm * Update reversestring.s Fixed Restoring * [x86] challenge 7 * [x86] Challenge 4 (Unreviewed) --- challenge_4/x86/x95/README.md | 16 +++++ challenge_4/x86/x95/src/challenge4.c | 100 +++++++++++++++++++++++++++ challenge_4/x86/x95/src/invertTree.s | 62 +++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 challenge_4/x86/x95/README.md create mode 100644 challenge_4/x86/x95/src/challenge4.c create mode 100644 challenge_4/x86/x95/src/invertTree.s diff --git a/challenge_4/x86/x95/README.md b/challenge_4/x86/x95/README.md new file mode 100644 index 000000000..33a9fd23d --- /dev/null +++ b/challenge_4/x86/x95/README.md @@ -0,0 +1,16 @@ +#Inverting a Binary Tree in x86-Assembly (64-Bit) + +##Contents +invertTree.s contains the main fuction invertTree which inverts the input tree. + +The caller to the function only needs to provide the address to the root. +##Compiling +``` +$ as invertTree.s -o invertTree.o +$ gcc -m64 challenge4.c invertTree.o -o c4 +``` +tested on Ubuntu 16.04 64-Bit +##Testing +To test the implementation just start the c4 application. + +It will recreate the tree from the challenge and then traverse it in post-order. Then the ASM function will invert the tree. To check the result, the application will traverse the tree in post-order yet again. diff --git a/challenge_4/x86/x95/src/challenge4.c b/challenge_4/x86/x95/src/challenge4.c new file mode 100644 index 000000000..bcd57000a --- /dev/null +++ b/challenge_4/x86/x95/src/challenge4.c @@ -0,0 +1,100 @@ +#include +#include +#include +#include + +// Tree Element (Exactly 24 Bytes in size by using 64-Bit Integer) +struct node +{ + int64_t data; + struct node* rightchild; + struct node* leftchild; +}; + +//Pointer to tree +struct node* tree; + +//Function Prototypes +void initTree(); +void destroyTree(); +void traverseTree(); +extern void invertTree(struct node* entry); //<-- ASM Method for inverting the tree + +//Main Method +int main() +{ + printf("Initialize Tree...\n\n"); + initTree(); + printf("Root Data: %" PRId64 "\n", tree->data); + printf("Right Node: %p\n",tree->rightchild); + printf("Left Node: %p\n\n",tree->leftchild); + printf("Traverse Tree in PostOrder:\n"); + traverseTree(tree); + printf("\n\nInverting Tree...\n\n"); + invertTree(tree); + printf("Traverse Tree in PostOrder:\n"); + traverseTree(tree); + printf("\n\nCleaning up...\n"); + destroyTree(); + return 0; +} + +//Fill tree with test values +void initTree() +{ + tree = calloc(1,sizeof(struct node)); + tree->data = 4; + tree->rightchild = calloc(1,sizeof(struct node)); + + tree->rightchild->data = 7; + tree->rightchild->rightchild = calloc(1,sizeof(struct node)); + tree->rightchild->rightchild->data = 9; + tree->rightchild->rightchild->rightchild = NULL; + tree->rightchild->rightchild->leftchild = NULL; + + tree->rightchild->leftchild = calloc(1,sizeof(struct node)); + tree->rightchild->leftchild->data = 6; + tree->rightchild->leftchild->rightchild = NULL; + tree->rightchild->leftchild->leftchild = NULL; + + tree->leftchild = calloc(1,sizeof(struct node)); + tree->leftchild->data = 2; + tree->leftchild->rightchild = calloc(1,sizeof(struct node)); + tree->leftchild->rightchild->data = 3; + tree->leftchild->rightchild->rightchild = NULL; + tree->leftchild->rightchild->leftchild = NULL; + + tree->leftchild->leftchild = calloc(1,sizeof(struct node)); + tree->leftchild->leftchild->data = 1; + tree->leftchild->leftchild->rightchild = NULL; + tree->leftchild->leftchild->leftchild = NULL; + +} + +//Traverse Tree in PostOrder +void traverseTree(struct node* entry) +{ + if(entry->leftchild != NULL) + { + traverseTree(entry->leftchild); + } + if(entry->rightchild != NULL) + { + traverseTree(entry->rightchild); + } + printf("%" PRId64 ", ", entry->data); +} + +//Free Memory +void destroyTree() +{ + free(tree->rightchild->rightchild); + free(tree->rightchild->leftchild); + free(tree->rightchild); + + free(tree->leftchild->rightchild); + free(tree->leftchild->leftchild); + free(tree->leftchild); + + free(tree); +} \ No newline at end of file diff --git a/challenge_4/x86/x95/src/invertTree.s b/challenge_4/x86/x95/src/invertTree.s new file mode 100644 index 000000000..36b9463db --- /dev/null +++ b/challenge_4/x86/x95/src/invertTree.s @@ -0,0 +1,62 @@ +.text +.global invertTree + +invertTree: + #x86 Prolog + pushq %rbp + movq %rsp, %rbp + + # %rdi is input according to AMD64 + xorq %rsi,%rsi # %rsi is used to read/write nodes from memory + xorq %r8,%r8 # %r8 saves the address of the right node + xorq %r9,%r9 # %r9 saves the address of the left node + + # Get the right node + movq %rdi,%rsi + add $8, %rsi + movq (%rsi),%rsi + + # Traverse right node first + cmp $0,%rsi + je skip_right + pushq %rdi # Preserve %rdi and proceed with %rsi + movq %rsi,%rdi + call invertTree + popq %rdi + skip_right: + + # Get the left node + movq %rdi,%rsi + add $16, %rsi + movq (%rsi),%rsi + + # Traverse left node + cmp $0,%rsi + je skip_left + pushq %rdi # Preserve %rdi and proceed with %rsi + movq %rsi,%rdi + call invertTree + popq %rdi + skip_left: + + # Get addresses of both nodes + movq %rdi,%r8 + add $8,%r8 + movq %r8,%r9 + add $8,%r9 + movq (%r8),%r8 + movq (%r9),%r9 + xchgq %r8,%r9 # Switch %r8,%r9 + + # Write Back + movq %rdi,%rsi + add $8,%rsi + movq %r8,(%rsi) + add $8,%rsi + movq %r9,(%rsi) + + + #x86 Epilog + movq %rbp , %rsp + popq %rbp + ret From 1fd36df83710c568bc1108f7c07c5bbe2c2e9575 Mon Sep 17 00:00:00 2001 From: xor-eax-eax Date: Mon, 16 Jan 2017 00:23:05 -0500 Subject: [PATCH 50/95] C Challenge 0 (Unreviewed) --- challenge_0/c/xor-eax-eax/README.md | 41 ++++++++++++++++++++++ challenge_0/c/xor-eax-eax/src/challenge0.c | 8 +++++ 2 files changed, 49 insertions(+) create mode 100644 challenge_0/c/xor-eax-eax/README.md create mode 100755 challenge_0/c/xor-eax-eax/src/challenge0.c diff --git a/challenge_0/c/xor-eax-eax/README.md b/challenge_0/c/xor-eax-eax/README.md new file mode 100644 index 000000000..231aadf49 --- /dev/null +++ b/challenge_0/c/xor-eax-eax/README.md @@ -0,0 +1,41 @@ +# Challenge_0 +###### C compiled with gcc 4.2.1 + +### 1. Approch to Solving the problem + +This one is pretty straight forward. Just have to understand what standard library +and standard library function is used to print something out to the command line +printf() was used here. Tons of print options exist depending on what type of file +you want to print to. ( printf, fprintf, sprintf, snprintf, asprintf, dprintf, vprintf, +vfprintf, vsprintf, vsnprintf, vasprintf,vdprintf). I wanted to print to standard out +so printf() was used. + +### 2. How to compile and run this code + +Make sure that you have gcc installed on your *nix machine. To see if you have +it installed you can type: + +``` +$ gcc --version +''' +in bash. + + +Compiling: +``` +$ gcc -o challenge0 challenge0.c +``` +Or optionally with symbols that aid in debugging, not that you'd +need that for a hello world... +``` +$ gcc -g -o challenge0 challenge0.c +``` + +### 3. How this program works + +After the program has compiled with no errors: +``` +$ ./challenge0 +Hello world! + +``` diff --git a/challenge_0/c/xor-eax-eax/src/challenge0.c b/challenge_0/c/xor-eax-eax/src/challenge0.c new file mode 100755 index 000000000..022b16ecb --- /dev/null +++ b/challenge_0/c/xor-eax-eax/src/challenge0.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("Hello world!\n"); + return 0; +} From fd09abc96160a6c55ee2c15329c2909af68cd96b Mon Sep 17 00:00:00 2001 From: xor-eax-eax Date: Mon, 16 Jan 2017 00:43:50 -0500 Subject: [PATCH 51/95] C Challenge 0 (Unreviewed) --- challenge_0/c/xor-eax-eax/README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/challenge_0/c/xor-eax-eax/README.md b/challenge_0/c/xor-eax-eax/README.md index 231aadf49..43c6fbba0 100644 --- a/challenge_0/c/xor-eax-eax/README.md +++ b/challenge_0/c/xor-eax-eax/README.md @@ -3,11 +3,11 @@ ### 1. Approch to Solving the problem -This one is pretty straight forward. Just have to understand what standard library -and standard library function is used to print something out to the command line +This one is pretty straight forward. You jut have to understand what standard library +and standard library function will be used to print something out to the command line -- printf() was used here. Tons of print options exist depending on what type of file -you want to print to. ( printf, fprintf, sprintf, snprintf, asprintf, dprintf, vprintf, -vfprintf, vsprintf, vsnprintf, vasprintf,vdprintf). I wanted to print to standard out +you want to print to ( printf, fprintf, sprintf, snprintf, asprintf, dprintf, vprintf, +vfprintf, vsprintf, vsnprintf, vasprintf, vdprintf). I wanted to print to standard out so printf() was used. ### 2. How to compile and run this code @@ -17,9 +17,7 @@ it installed you can type: ``` $ gcc --version -''' -in bash. - +``` Compiling: ``` From 8e70f76419933887cca84064a7097f0900befdf3 Mon Sep 17 00:00:00 2001 From: D Davis Date: Mon, 16 Jan 2017 02:52:49 -0500 Subject: [PATCH 52/95] [Python] Challenge 1(Unreviewed) (#402) --- challenge_1/python/dfdx2/reverse.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge_1/python/dfdx2/reverse.py diff --git a/challenge_1/python/dfdx2/reverse.py b/challenge_1/python/dfdx2/reverse.py new file mode 100644 index 000000000..74eed782f --- /dev/null +++ b/challenge_1/python/dfdx2/reverse.py @@ -0,0 +1 @@ +print("hello"[::-1]) \ No newline at end of file From 9a403ac28d4af5b1b0971bb2f24cc5258c05b97e Mon Sep 17 00:00:00 2001 From: tyleroar Date: Mon, 16 Jan 2017 10:49:43 -0500 Subject: [PATCH 53/95] C Challenge 1 (Unreviewed) --- challenge_1/c/tyleroar/README.md | 1 + challenge_1/c/tyleroar/src/strings.c | 33 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 challenge_1/c/tyleroar/README.md create mode 100644 challenge_1/c/tyleroar/src/strings.c diff --git a/challenge_1/c/tyleroar/README.md b/challenge_1/c/tyleroar/README.md new file mode 100644 index 000000000..16decb5f8 --- /dev/null +++ b/challenge_1/c/tyleroar/README.md @@ -0,0 +1 @@ +String reversing in C diff --git a/challenge_1/c/tyleroar/src/strings.c b/challenge_1/c/tyleroar/src/strings.c new file mode 100644 index 000000000..8bfb1d483 --- /dev/null +++ b/challenge_1/c/tyleroar/src/strings.c @@ -0,0 +1,33 @@ +#include +#include +#include +char *readLine() { + int length = 1; + char *string = NULL; + char c; + while (EOF!=(c=getchar()) && '\r'!=c && '\n' != c) { + string=realloc(string,length); + string[length-1]=c; + length++; + } + string[length-1]='\0'; + return string; +} +int main(int argc, char **argv) { + char *input = readLine(); + char temp; + int length=0, i=0; + for (temp=input[length]; temp!='\0'; length++) temp=input[length]; + length--; + char *output = (char*) malloc(sizeof(char)*(length+1)); + if(length==0) { + output[0]='\0'; + } + else { + for (i=0; i Date: Mon, 16 Jan 2017 11:16:45 -0500 Subject: [PATCH 54/95] C Challenge 1 (Unreviewed) --- challenge_1/c/xor-eax-eax/README.md | 38 ++++++++++++++++++++++ challenge_1/c/xor-eax-eax/src/challenge1.c | 28 ++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 challenge_1/c/xor-eax-eax/README.md create mode 100644 challenge_1/c/xor-eax-eax/src/challenge1.c diff --git a/challenge_1/c/xor-eax-eax/README.md b/challenge_1/c/xor-eax-eax/README.md new file mode 100644 index 000000000..45b600631 --- /dev/null +++ b/challenge_1/c/xor-eax-eax/README.md @@ -0,0 +1,38 @@ +# Challenge_1 +###### C compiled with gcc 4.2.1 + +### 1. Approch to Solving the problem + +Reversing strings in C is a little bit more challenging than +higher level languages. Since basically everything is a pointer +to memory of a particular size, you must make sure that the variables +you're creating have the approprate space. In short, I created two +character arrays and looped through them from opposite directions, +the original's end filling the beginning of the reverse string. + +### 2. How to compile and run this code + +Make sure that you have gcc installed on your *nix machine. To see if you have +it installed you can type: + +``` +$ gcc --version +``` + +Compiling: +``` +$ gcc -o challenge1 challenge1.c +``` +Or optionally with symbols that aid in debugging. +``` +$ gcc -g -o challenge0 challenge0.c +``` + +### 3. How this program works + +After the program has compiled with no errors: +``` +$ ./challenge1 +olleH + +``` diff --git a/challenge_1/c/xor-eax-eax/src/challenge1.c b/challenge_1/c/xor-eax-eax/src/challenge1.c new file mode 100644 index 000000000..e203cf584 --- /dev/null +++ b/challenge_1/c/xor-eax-eax/src/challenge1.c @@ -0,0 +1,28 @@ +#include +#include +#include // for memset + +int main() +{ + // Initialize a character array with the string you want to reverse. + char helloString[] = "Hello"; + // Get length of 0-indexed string, this will be used for index looping + int strSize = strlen(helloString); + // Instantiated character array equal to the size of the original + char revHelloStr[strSize]; + // Set the values of the reverse character array to zero, this takes care of the null terminator at the end + memset(revHelloStr, 0, strSize*sizeof(char)); + // subtracted one to disclude the null terminator. That is taken care of in revHelloStr by the memset + int i = strSize-1; + int j = 0; + // Perform a count from the front to back of the character array for the reverse string + // while counting from the back of the hello string, skipping the null terminator + for (i,j ; i>=0 && j<=strSize-1 ; i--, j++) + { + revHelloStr[j] = helloString[i]; + + } + printf("%s",revHelloStr); + + return 0; +} From 2332c46c7ba1eae3419e5be6f785646c98f9c34b Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Mon, 16 Jan 2017 13:33:26 -0500 Subject: [PATCH 55/95] added challenge 13 --- challenge_13/README.md | 52 +++++++++++++++++++ .../java/slandau3/src/IntegerPalindrome.java | 30 +++++++++++ challenge_13/tests/test1 | 1 + challenge_13/tests/test2 | 1 + challenge_13/tests/test3 | 1 + challenge_13/tests/test4 | 1 + challenge_13/tests/test5 | 1 + 7 files changed, 87 insertions(+) create mode 100644 challenge_13/README.md create mode 100644 challenge_13/java/slandau3/src/IntegerPalindrome.java create mode 100644 challenge_13/tests/test1 create mode 100644 challenge_13/tests/test2 create mode 100644 challenge_13/tests/test3 create mode 100644 challenge_13/tests/test4 create mode 100644 challenge_13/tests/test5 diff --git a/challenge_13/README.md b/challenge_13/README.md new file mode 100644 index 000000000..d01c41b08 --- /dev/null +++ b/challenge_13/README.md @@ -0,0 +1,52 @@ +# Integer Palindrome + +### Challenge + +Another classic problem. A palindrome is a word that is the same when read forward or backward, like **racecar** or **tacocat**. +Write a program that takes in a positive integer value **(12321)**, and returns boolean **(true)** if the integer is a palindrome. + +The program should take a number from standard input (this is the only time you will be allowed to perform a cast) and use that as the number to be checked. The resulting boolean should be outputted to standard output. + +### Constraints +1. Your program must not use any "built-in" methods or classes, only generics. +2. This means nothing like *String.valueOf()* or *.equals()* or *.reverse()* +3. **Your program must not use Strings or Characters in any form. Only numbers (integers/doubles)** + +Input can be expected to have at least 1 digit and all digits are positive. +Input will not have any leading or trailing 0s like **0123210** but **1230550321** is acceptable input. + +Your program should run in O(n) time with O(n) space. + +### Example + +In: 1112111 +Out: true + +In: 1 +Out: true + +In: 59112 +Out: false + +In: 1234554321 +Out: true + +In: 22 +Out: true + +In: 1010100101 +Out: false + +In: 1010110101 +Out: true + +Testing +------ +The test cases can be found in the tests directory. The program, when tested with the test cases should output the boolean listed. +* test1: true +* test2: true +* test3: false +* test4: false +* test5: true + +Challenge created by @jdfurlan diff --git a/challenge_13/java/slandau3/src/IntegerPalindrome.java b/challenge_13/java/slandau3/src/IntegerPalindrome.java new file mode 100644 index 000000000..ffcb38354 --- /dev/null +++ b/challenge_13/java/slandau3/src/IntegerPalindrome.java @@ -0,0 +1,30 @@ +import java.util.Scanner; + +/** + * Created by slandau on 1/11/17. + */ +public class IntegerPalindrome { + + public static boolean palindrome(long input) { + // The reversed integer + long reversed = 0; + // A temporary variable for the input + long temp = input; + + // Reverse the input and store it in the reversed variable + while (temp != 0) { + reversed *= 10; // multiply reversed by 10 so that we can add a new + // integer to the end of it without it affecting the entire number + reversed += temp % 10; // Get the last number of the input + temp /= 10; // remove the last number of the input (temporary number) + } + + return reversed == input; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + long input = in.nextLong(); + System.out.println(palindrome(input)); + } +} diff --git a/challenge_13/tests/test1 b/challenge_13/tests/test1 new file mode 100644 index 000000000..3acca38af --- /dev/null +++ b/challenge_13/tests/test1 @@ -0,0 +1 @@ +1221 diff --git a/challenge_13/tests/test2 b/challenge_13/tests/test2 new file mode 100644 index 000000000..261a86b72 --- /dev/null +++ b/challenge_13/tests/test2 @@ -0,0 +1 @@ +18433481 diff --git a/challenge_13/tests/test3 b/challenge_13/tests/test3 new file mode 100644 index 000000000..257e56326 --- /dev/null +++ b/challenge_13/tests/test3 @@ -0,0 +1 @@ +102 diff --git a/challenge_13/tests/test4 b/challenge_13/tests/test4 new file mode 100644 index 000000000..42a548483 --- /dev/null +++ b/challenge_13/tests/test4 @@ -0,0 +1 @@ +5055 diff --git a/challenge_13/tests/test5 b/challenge_13/tests/test5 new file mode 100644 index 000000000..7cc86ad13 --- /dev/null +++ b/challenge_13/tests/test5 @@ -0,0 +1 @@ +666 From b56be802cdeb8b4f48ade4979e81a5f5afea7e60 Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Mon, 16 Jan 2017 13:37:14 -0500 Subject: [PATCH 56/95] Removed a part of one of the constraints Allowed them to use .equals() (they should be using == but no harm will come from .equals) --- challenge_13/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge_13/README.md b/challenge_13/README.md index d01c41b08..96bcf7e4f 100644 --- a/challenge_13/README.md +++ b/challenge_13/README.md @@ -9,7 +9,7 @@ The program should take a number from standard input (this is the only time you ### Constraints 1. Your program must not use any "built-in" methods or classes, only generics. -2. This means nothing like *String.valueOf()* or *.equals()* or *.reverse()* +2. This means nothing like *String.valueOf()* or *.reverse()* 3. **Your program must not use Strings or Characters in any form. Only numbers (integers/doubles)** Input can be expected to have at least 1 digit and all digits are positive. From 50cc308489eb8a82add45513554da5808106e1e8 Mon Sep 17 00:00:00 2001 From: slansford Date: Mon, 16 Jan 2017 16:27:13 -0600 Subject: [PATCH 57/95] [Python] Challenge 7 (Pending) (#390) * [Python] Challenge 7 (Unreviewed) * [Python] Challenge 7 Unreviewed) --- challenge_7/python/slansford/README.md | 5 ++++ .../python/slansford/src/challenge_7.py | 10 +++++++ challenge_7/python/slansford/src/test.py | 28 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 challenge_7/python/slansford/README.md create mode 100644 challenge_7/python/slansford/src/challenge_7.py create mode 100644 challenge_7/python/slansford/src/test.py diff --git a/challenge_7/python/slansford/README.md b/challenge_7/python/slansford/README.md new file mode 100644 index 000000000..80b5a7ed7 --- /dev/null +++ b/challenge_7/python/slansford/README.md @@ -0,0 +1,5 @@ +Function missingNo in challenge_7.py takes one input, a list with numbers ranging from 0 - N with one missing number, and returns the missing number. + +Completes test in an average of 0.0083 seconds. + +Uses Python 3.6.0 \ No newline at end of file diff --git a/challenge_7/python/slansford/src/challenge_7.py b/challenge_7/python/slansford/src/challenge_7.py new file mode 100644 index 000000000..9ce3e1571 --- /dev/null +++ b/challenge_7/python/slansford/src/challenge_7.py @@ -0,0 +1,10 @@ +def missingNo(inputList): + + minInt = min(inputList) + maxInt = max(inputList) + + if minInt != 0: + return 0 + + else: + return sum(range(minInt,(maxInt + 1))) - sum(inputList) \ No newline at end of file diff --git a/challenge_7/python/slansford/src/test.py b/challenge_7/python/slansford/src/test.py new file mode 100644 index 000000000..8fac0e281 --- /dev/null +++ b/challenge_7/python/slansford/src/test.py @@ -0,0 +1,28 @@ +import unittest +import time +from challenge_7 import missingNo + + +class Tests(unittest.TestCase): + + def test1(self): + t1 = time.time() + self.assertEqual(missingNo([0,1,2,3,4,5,7,8,9]),6) + t2 = time.time() + print('Runtime test1: ' + str(t2-t1)) + + def test2(self): + t1 = time.time() + self.assertEqual(missingNo([0,1,2,3,4,5,6,7,9,10,11,12,13]),8) + t2 = time.time() + print('Runtime test1: ' + str(t2-t1)) + + def test3(self): + t1 = time.time() + self.assertEqual(missingNo([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118,2119,2120,2121,2122,2123,2124,2125,2126,2127,2128,2129,2130,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,2142,2143,2144,2145,2146,2147,2148,2149,2150,2151,2152,2153,2154,2155,2156,2157,2158,2159,2160,2161,2162,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190,2191,2192,2193,2194,2195,2196,2197,2198,2199,2200,2201,2202,2203,2204,2205,2206,2207,2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,2295,2296,2297,2298,2299,2300,2301,2302,2303,2304,2305,2306,2307,2308,2309,2310,2311,2312,2313,2314,2315,2316,2317,2318,2319,2320,2321,2322,2323,2324,2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2337,2338,2339,2340,2341,2342,2343,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,2356,2357,2358,2359,2360,2361,2362,2363,2364,2365,2366,2367,2368,2369,2370,2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2383,2384,2385,2386,2387,2388,2389,2390,2391,2392,2393,2394,2395,2396,2397,2398,2399,2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415,2416,2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2427,2428,2429,2430,2431,2432,2433,2434,2435,2436,2437,2438,2439,2440,2441,2442,2443,2444,2445,2446,2447,2448,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,2463,2464,2465,2466,2467,2468,2469,2470,2471,2472,2473,2474,2475,2476,2477,2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2492,2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,2509,2510,2511,2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,2524,2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2620,2621,2622,2623,2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,2944,2945,2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976,2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071,3072,3073,3074,3075,3076,3077,3078,3079,3080,3081,3082,3083,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119,3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172,3173,3174,3175,3176,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187,3188,3189,3190,3191,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233,3234,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248,3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,3278,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295,3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327,3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,3361,3362,3363,3364,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374,3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,3388,3389,3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410,3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3439,3440,3441,3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3454,3455,3456,3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3470,3471,3472,3473,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,3487,3488,3489,3490,3491,3492,3493,3494,3495,3496,3497,3498,3499,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516,3517,3518,3519,3520,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541,3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,3580,3581,3582,3583,3584,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695,3696,3697,3698,3699,3700,3701,3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3716,3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,3767,3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,3779,3780,3781,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,3796,3797,3798,3799,3800,3801,3802,3803,3804,3805,3806,3807,3808,3809,3810,3811,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,3822,3823,3824,3825,3826,3827,3828,3829,3830,3831,3832,3833,3834,3835,3836,3837,3838,3839,3840,3841,3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3943,3944,3945,3946,3947,3948,3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,3978,3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4081,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098,4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,4138,4139,4140,4141,4142,4143,4144,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157,4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173,4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189,4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205,4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,4220,4221,4222,4223,4224,4225,4226,4227,4228,4229,4230,4231,4232,4233,4234,4235,4236,4237,4238,4239,4240,4241,4242,4243,4244,4245,4246,4247,4248,4249,4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265,4266,4267,4268,4269,4270,4271,4272,4273,4274,4275,4276,4277,4278,4279,4280,4281,4282,4283,4284,4285,4286,4287,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310,4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326,4327,4328,4329,4330,4331,4332,4333,4334,4335,4336,4337,4338,4339,4340,4341,4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357,4358,4359,4360,4361,4362,4363,4364,4365,4366,4367,4368,4369,4370,4371,4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387,4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,4417,4418,4419,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429,4430,4431,4432,4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,4443,4444,4445,4446,4447,4448,4449,4450,4451,4452,4453,4454,4455,4456,4457,4458,4459,4460,4461,4462,4463,4464,4465,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476,4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,4490,4491,4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507,4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,4519,4520,4521,4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,4536,4537,4538,4539,4540,4541,4542,4543,4544,4545,4546,4547,4548,4549,4550,4551,4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567,4568,4569,4570,4571,4572,4573,4574,4575,4576,4577,4578,4579,4580,4581,4582,4583,4584,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611,4612,4613,4614,4615,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626,4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642,4643,4644,4645,4646,4647,4648,4649,4650,4651,4652,4653,4654,4655,4656,4657,4658,4659,4660,4661,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672,4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,4683,4684,4685,4686,4687,4688,4689,4690,4691,4692,4693,4694,4695,4696,4697,4698,4699,4700,4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,4712,4713,4714,4715,4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731,4732,4733,4734,4735,4736,4737,4738,4739,4740,4741,4742,4743,4744,4745,4746,4747,4748,4749,4750,4751,4752,4753,4754,4755,4756,4757,4758,4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,4769,4770,4771,4772,4773,4774,4775,4776,4777,4778,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788,4789,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803,4804,4805,4806,4807,4808,4809,4810,4811,4812,4813,4814,4815,4816,4817,4818,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832,4833,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847,4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863,4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879,4880,4881,4882,4883,4884,4885,4886,4887,4888,4889,4890,4891,4892,4893,4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909,4910,4911,4912,4913,4914,4915,4916,4917,4918,4919,4920,4921,4922,4923,4924,4925,4926,4927,4928,4929,4930,4931,4932,4933,4934,4935,4936,4937,4938,4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954,4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970,4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,4981,4982,4983,4984,4985,4986,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999,5000,5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011,5012,5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,5040,5041,5042,5043,5044,5045,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,5056,5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072,5073,5074,5075,5076,5077,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,5113,5114,5115,5116,5117,5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149,5150,5151,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177,5178,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192,5193,5194,5195,5196,5197,5198,5199,5200,5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212,5213,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,5248,5249,5250,5251,5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299,5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385,5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440,5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552,5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632,5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648,5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664,5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712,5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728,5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744,5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776,5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132,6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180,6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212,6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259,6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287,6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317,6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334,6335,6336,6337,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411,6412,6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456,6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565,6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581,6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629,6630,6631,6632,6633,6634,6635,6636,6637,6638,6639,6640,6641,6642,6643,6644,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659,6660,6661,6662,6663,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761,6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779,6780,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,6905,6906,6907,6908,6909,6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934,6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950,6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968,6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984,6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,6995,6996,6997,6998,6999,7000,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042,7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074,7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138,7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186,7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213,7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312,7313,7314,7315,7316,7317,7318,7319,7320,7321,7322,7323,7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455,7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503,7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567,7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615,7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631,7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695,7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711,7712,7713,7714,7715,7716,7717,7718,7719,7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759,7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807,7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983,7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047,8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749,8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,8764,8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780,8781,8782,8783,8784,8785,8786,8787,8788,8789,8790,8791,8792,8793,8794,8795,8796,8797,8798,8799,8800,8801,8802,8803,8804,8805,8806,8807,8808,8809,8810,8811,8812,8813,8814,8815,8816,8817,8818,8819,8820,8821,8822,8823,8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839,8840,8841,8842,8843,8844,8845,8846,8847,8848,8849,8850,8851,8852,8853,8854,8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870,8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,8885,8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901,8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917,8918,8919,8920,8921,8922,8923,8924,8925,8926,8927,8928,8929,8930,8931,8932,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,8944,8945,8946,8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962,8963,8964,8965,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977,8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055,9056,9057,9058,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085,9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101,9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117,9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133,9134,9135,9136,9137,9138,9139,9140,9141,9142,9143,9144,9145,9146,9147,9148,9149,9150,9151,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163,9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,9176,9177,9178,9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194,9195,9196,9197,9198,9199,9200,9201,9202,9203,9204,9205,9206,9207,9208,9209,9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,9223,9224,9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240,9241,9242,9243,9244,9245,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255,9256,9257,9258,9259,9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272,9273,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,9347,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,9374,9375,9376,9377,9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405,9406,9407,9408,9409,9410,9411,9412,9413,9414,9415,9416,9417,9418,9419,9420,9421,9422,9423,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448,9449,9450,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461,9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,9473,9474,9475,9476,9477,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552,9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599,9600,9601,9602,9603,9604,9605,9606,9607,9608,9609,9610,9611,9612,9613,9614,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628,9629,9630,9631,9632,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658,9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,9673,9674,9675,9676,9677,9678,9679,9680,9681,9682,9683,9684,9685,9686,9687,9688,9689,9690,9691,9692,9693,9694,9695,9696,9697,9698,9699,9700,9701,9702,9703,9704,9705,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715,9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731,9732,9733,9734,9735,9736,9737,9738,9739,9740,9741,9742,9743,9744,9745,9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,9759,9760,9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,9778,9779,9780,9781,9782,9783,9784,9785,9786,9787,9788,9789,9790,9791,9792,9793,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822,9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838,9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854,9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,9869,9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885,9886,9887,9888,9889,9890,9891,9892,9893,9894,9895,9896,9897,9898,9899,9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,9915,9916,9917,9918,9919,9920,9921,9922,9923,9924,9925,9926,9927,9928,9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944,9945,9946,9947,9948,9949,9950,9951,9952,9953,9954,9955,9956,9957,9958,9959,9960,9961,9962,9963,9964,9965,9966,9967,9968,9969,9970,9971,9972,9973,9974,9975,9976,9977,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987,9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,]),23) + t2 = time.time() + print('Runtime test1: ' + str(t2-t1)) + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From 798f4b32548315d54f0ab1ea8be59bd1be0c3a0b Mon Sep 17 00:00:00 2001 From: tyleroar Date: Mon, 16 Jan 2017 17:49:41 -0500 Subject: [PATCH 58/95] C Challenge 0 (Unreviewed) (#409) --- challenge_0/c/tyleroar/README.md | 1 + challenge_0/c/tyleroar/src/hello_world.c | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 challenge_0/c/tyleroar/README.md create mode 100644 challenge_0/c/tyleroar/src/hello_world.c diff --git a/challenge_0/c/tyleroar/README.md b/challenge_0/c/tyleroar/README.md new file mode 100644 index 000000000..8a7e3b248 --- /dev/null +++ b/challenge_0/c/tyleroar/README.md @@ -0,0 +1 @@ +Hello World in C diff --git a/challenge_0/c/tyleroar/src/hello_world.c b/challenge_0/c/tyleroar/src/hello_world.c new file mode 100644 index 000000000..459b2f85b --- /dev/null +++ b/challenge_0/c/tyleroar/src/hello_world.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello world!\n"); + return 0; +} From deded86d05d68aaa58926146ee6b7bbd8767d470 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Mon, 16 Jan 2017 20:05:03 -0800 Subject: [PATCH 59/95] Testfiles for ch11 (#417) * new test * fixed testfiles and readme * made testfiles * testfiles created * fixed testfiles * ch9 testfiles * remved extra tests * Update README.md * Update README.md --- challenge_11/README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/challenge_11/README.md b/challenge_11/README.md index 8bf9f1eb0..40c71f343 100644 --- a/challenge_11/README.md +++ b/challenge_11/README.md @@ -9,7 +9,7 @@ Binary Trees are a big deal in computer science. It's only fitting that we have * findLargest - finds and returns the node with the largest data value * insert - inserts a node into the BST, mostly useful for testing. - Testing + [Testing](https://github.com/YearOfProgramming/2017Challenges#testing) ----- Testing for this challenge is fairly straight forward. Simply insert a bunch of nodes into the BST, remove one then print the BST to ensure that it was removed. @@ -18,3 +18,33 @@ Binary Trees are a big deal in computer science. It's only fitting that we have * The tree should now be printed in pre-order * A new prompt should appear asking what value(s) the user would like to delete from the tree. This input will be space seperated and non repeating. * The program should output the tree again, in pre order then terminate. + + ##### Testing with the test script + + You will receive a few values line by line: + + 1. `i#` where `i` means to insert the `#` (e.g. `i24`). + 2. `d#` where `d` means to delete the node with the `#` (e.g. `d24`). + 3. `oin`, `opre`, `opost`, where the `o` means output and `in` means print out in order, `pre` means preorder, and `post`, means post order. + 4. `e` means to stop end. + + Look at the `testfiles/` directory to look at the testfiles. + + +Example: + + i2 + i3 + oin + opre + d2 + e + +This means to insert 2, insert 3, print out in order, print out pre order, delete 2, and end your program. + +Expected output: + + 2 + 3 + 2 + 3 From 5adff1e5bdd532c420165f7a75a15647e622aca5 Mon Sep 17 00:00:00 2001 From: Manuel Meraz Date: Mon, 16 Jan 2017 20:09:03 -0800 Subject: [PATCH 60/95] testfiles for ch11 (#418) * new test * fixed testfiles and readme * made testfiles * testfiles created * fixed testfiles * ch9 testfiles * remved extra tests * testfiles for ch11 * Update README.md * Update README.md --- challenge_11/testfiles/o1 | 27 +++++++++++++++++++++++++++ challenge_11/testfiles/o2 | 39 +++++++++++++++++++++++++++++++++++++++ challenge_11/testfiles/o3 | 16 ++++++++++++++++ challenge_11/testfiles/o4 | 27 +++++++++++++++++++++++++++ challenge_11/testfiles/t1 | 14 ++++++++++++++ challenge_11/testfiles/t2 | 18 ++++++++++++++++++ challenge_11/testfiles/t3 | 16 ++++++++++++++++ challenge_11/testfiles/t4 | 19 +++++++++++++++++++ 8 files changed, 176 insertions(+) create mode 100644 challenge_11/testfiles/o1 create mode 100644 challenge_11/testfiles/o2 create mode 100644 challenge_11/testfiles/o3 create mode 100644 challenge_11/testfiles/o4 create mode 100644 challenge_11/testfiles/t1 create mode 100644 challenge_11/testfiles/t2 create mode 100644 challenge_11/testfiles/t3 create mode 100644 challenge_11/testfiles/t4 diff --git a/challenge_11/testfiles/o1 b/challenge_11/testfiles/o1 new file mode 100644 index 000000000..48d1af4e6 --- /dev/null +++ b/challenge_11/testfiles/o1 @@ -0,0 +1,27 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +5 +3 +2 +1 +4 +7 +6 +9 +8 +1 +2 +4 +3 +6 +8 +9 +7 +5 diff --git a/challenge_11/testfiles/o2 b/challenge_11/testfiles/o2 new file mode 100644 index 000000000..a770c42dc --- /dev/null +++ b/challenge_11/testfiles/o2 @@ -0,0 +1,39 @@ +2 +4 +6 +8 +9 +11 +12 +14 +15 +17 +21 +30 +40 +8 +4 +2 +6 +15 +9 +11 +12 +14 +40 +30 +17 +21 +2 +6 +4 +14 +12 +11 +9 +21 +17 +30 +40 +15 +8 diff --git a/challenge_11/testfiles/o3 b/challenge_11/testfiles/o3 new file mode 100644 index 000000000..df6c394f8 --- /dev/null +++ b/challenge_11/testfiles/o3 @@ -0,0 +1,16 @@ +1 +3 +4 +5 +8 +9 +2 +1 +11 +9 +5 +5 +1 +2 +9 +11 diff --git a/challenge_11/testfiles/o4 b/challenge_11/testfiles/o4 new file mode 100644 index 000000000..7e5c68e43 --- /dev/null +++ b/challenge_11/testfiles/o4 @@ -0,0 +1,27 @@ +15 +7 +5 +3 +1 +4 +8 +11 +9 +14 +7 +5 +3 +1 +8 +11 +9 +14 +7 +5 +3 +1 +2 +6 +11 +9 +14 diff --git a/challenge_11/testfiles/t1 b/challenge_11/testfiles/t1 new file mode 100644 index 000000000..9e79997af --- /dev/null +++ b/challenge_11/testfiles/t1 @@ -0,0 +1,14 @@ +i5 +i3 +i2 +i7 +i9 +i8 +i6 +i1 +i4 +oin +opre +opost +e + diff --git a/challenge_11/testfiles/t2 b/challenge_11/testfiles/t2 new file mode 100644 index 000000000..b4f189535 --- /dev/null +++ b/challenge_11/testfiles/t2 @@ -0,0 +1,18 @@ +i8 +i4 +i6 +i2 +i15 +i40 +i30 +i17 +i9 +i11 +i12 +i14 +i21 +oin +opre +opost +e + diff --git a/challenge_11/testfiles/t3 b/challenge_11/testfiles/t3 new file mode 100644 index 000000000..3540f75e8 --- /dev/null +++ b/challenge_11/testfiles/t3 @@ -0,0 +1,16 @@ +i5 +i3 +i4 +i1 +i8 +i9 +oin +d8 +i11 +i2 +d3 +d4 +opost +opre +e + diff --git a/challenge_11/testfiles/t4 b/challenge_11/testfiles/t4 new file mode 100644 index 000000000..68cb6ee88 --- /dev/null +++ b/challenge_11/testfiles/t4 @@ -0,0 +1,19 @@ +i15 +i7 +i8 +i5 +i11 +i9 +i14 +i3 +i4 +i1 +opre +d15 +d4 +opre +i2 +i6 +d8 +opre +e From 1bea6732e46f704f79ec5a9d135839d01051ab21 Mon Sep 17 00:00:00 2001 From: Alex Botello Date: Tue, 17 Jan 2017 00:17:20 -0600 Subject: [PATCH 61/95] Challenge 10 (#414) --- challenge_10/python/alexbotello/README.md | 24 +++++++++++++ .../python/alexbotello/src/closers.py | 35 +++++++++++++++++++ challenge_10/python/alexbotello/src/tests.py | 33 +++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 challenge_10/python/alexbotello/README.md create mode 100644 challenge_10/python/alexbotello/src/closers.py create mode 100644 challenge_10/python/alexbotello/src/tests.py diff --git a/challenge_10/python/alexbotello/README.md b/challenge_10/python/alexbotello/README.md new file mode 100644 index 000000000..d8292577a --- /dev/null +++ b/challenge_10/python/alexbotello/README.md @@ -0,0 +1,24 @@ +# Valid Closers +###### Language Version (Python 3.6.0) + + +For this challenge we implement a list as a stack. As we iterate through the +string input we add every opener found into the stack sequentially. + +As the iteration continues onto the closers, check the if closer matches the last +element in our stack. If match is successful, pop the element off the stack and continue. +If any pair fails to match then the string input contains an invalid closer and +the function returns False. + +After iteration is complete if our stack is empty then every opener had a valid +closer and the function returns True. + + +Run ```test.py``` to test code against the unit test. +``` +........ +---------------------------------------------------------------------- +Ran 8 tests in 0.001s + +OK +``` diff --git a/challenge_10/python/alexbotello/src/closers.py b/challenge_10/python/alexbotello/src/closers.py new file mode 100644 index 000000000..4eae34159 --- /dev/null +++ b/challenge_10/python/alexbotello/src/closers.py @@ -0,0 +1,35 @@ +# Valid Closers + +def is_valid_closer(string): + """ + Returns True if every opener has a valid closer + """ + openers = ['[', '(', '{'] + closers = [']', ')', '}'] + stack = [] + + for ch in string: + # If there is a closer, but no openers + if not stack and ch in closers: + return False + + # Add any opener into the stack + elif ch in openers: + stack.append(ch) + + # If the following closers do not pair with the opener popped from stack + # then the function will return False + elif ch == ']': + if stack.pop() != '[': + return False + + elif ch == ')': + if stack.pop() != '(': + return False + + elif ch == '}': + if stack.pop() != '{': + return False + + # Nothing in our stack == True + return not stack diff --git a/challenge_10/python/alexbotello/src/tests.py b/challenge_10/python/alexbotello/src/tests.py new file mode 100644 index 000000000..a1707dc92 --- /dev/null +++ b/challenge_10/python/alexbotello/src/tests.py @@ -0,0 +1,33 @@ +import unittest + +from closers import is_valid_closer + +class Test(unittest.TestCase): + + def test1(self): + self.assertEqual(is_valid_closer('{{{{{{{{{adfkjaefia}}}}}}}'), False) + + def test2(self): + self.assertEqual(is_valid_closer('{{{{{{{{{[[[[[[kadfa{{{{{{{((({daljfdaf({{{[]}}kaldjfs})})))}}}}}}}]]]]]]}kjfela}}}}}}}}'), True) + + def test3(self): + self.assertEqual(is_valid_closer('{{{[}}}}dafda'), False) + + def test4(self): + self.assertEqual(is_valid_closer('{{{{{{{{{}}}}}}}}}'), True) + + def test5(self): + self.assertEqual(is_valid_closer('[[[[[[[[[kafjalfeianfailfeja;fjai;efa;sfj]]]]]]]]]kjajdain'), True) + + def test6(self): + self.assertEqual(is_valid_closer(''), True) + + def test7(self): + self.assertEqual(is_valid_closer('((((((fjdalfeja((((alefjalisj(())))))))))))d'), True) + + def test8(self): + self.assertEqual(is_valid_closer(')))(((d'), False) + + +if __name__ == '__main__': + unittest.main() From b252de42677ba0754397b9ecd3b59ceb3d1a4ba0 Mon Sep 17 00:00:00 2001 From: ningSP4 Date: Tue, 17 Jan 2017 14:24:34 +0800 Subject: [PATCH 62/95] Challenge #13: Add solution in python --- challenge_13/python/ning/README.md | 43 +++++++++++++++++++ challenge_13/python/ning/challenge_13.py | 54 ++++++++++++++++++++++++ challenge_13/python/ning/test.py | 54 ++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 challenge_13/python/ning/README.md create mode 100644 challenge_13/python/ning/challenge_13.py create mode 100644 challenge_13/python/ning/test.py diff --git a/challenge_13/python/ning/README.md b/challenge_13/python/ning/README.md new file mode 100644 index 000000000..80113078a --- /dev/null +++ b/challenge_13/python/ning/README.md @@ -0,0 +1,43 @@ +# Challenge #13, Integer Palindrome + +## Solution Logic + +1. We run through conditionals to check for non-palindromic integers. If they pass these tests, we assume them to be palindromic. +2. Single-digit integers are by definition (of this challenge, anyway) palindromes. These skip the main `while` loop and the function returns True straight away. For the rest... +3. First, we store the last digit (in the ones position) in the variable `ones`. In this process, the last digit of the given integer is also made to be zero. +4. Assuming the given integer is palindromic, we subtract the first digit, hence removing it. Next, divide the integer by 10 to remove the last integer. Hence, two digits from each end of the given integer is stripped off. Following this, there are 4 cases to consider. + +_Case 1_: 514 -> 11 +In this non-palindromic case, we end up after step (4) with the integer 11. The first digit was not stripped as it was larger than the last digit. As such, only one digit was stripped. We test for this case where the difference in digits after step (4) is only 1, and return False. + +_Case 2_: 415 -> -90 +This is our second non-palindromic case. As the first digit is smaller than the last, we end up with a negative integer. Testing for this is easy: `if _int < 0`. Naturally, the function returns False in this case. + +_Case 3_: 515 -> 1 +The ideal scenario. We end up with 1, and a difference of two digits. Since there is only one digit, the function breaks out of the while loop and returns True. + +_Case 4_: 10101 -> 10 +Tricky. We remove the two digits at both ends to get `010`, but the program reads this as `10`. To rememdy this, we detect the extra difference in digits (three stripped instead of two), and divide by 10 for each starting zero, getting `1` instead of `10`. + +_Case 5_: 10111-> 11 +A subset of _Case 4_, we detect a three digit difference, and the program continues as in the previous case to divide an extra time by 10, giving us `1.1`. Hence we must include an `if _int % 1 != 0` to detect for this case. + +## Functions + +1. `get_int_len` takes an integer input and returns the number of digits in that integer by comparing it to powers of 10. A more mathematical way to do this would be with log of base 10, but this would violate rule #1 with its use of the `math` module. +2. `check_palindrome` takes an integer input and returns True if it is an integer palindrome, and False if not. +3. `check_palindrome_str(_str) is a wrapper around the above `check_palindrome` function which takes a string input instead. + + +## Unit Test + +The unit test `test.py` consists of the seven examples provided in the challenge README.md, as well as a test case for the above descripted _Case 5_. + +``` +........ +---------------------------------------------------------------------- +Ran 8 tests in 0.000s + +OK +``` + diff --git a/challenge_13/python/ning/challenge_13.py b/challenge_13/python/ning/challenge_13.py new file mode 100644 index 000000000..5b4ef90b4 --- /dev/null +++ b/challenge_13/python/ning/challenge_13.py @@ -0,0 +1,54 @@ +def get_int_len(_int): + '''Find the number of digits of an int + + Given an integer, finds the number of + digits in that integer in base 10 + ''' + power = 1 + while True: + if _int == 0: + return 0 + elif _int < 10**power: + return power + power += 1 + +def check_palindrome(_int): + ones = 0 + digits = get_int_len(_int) + while digits > 1: + if _int % 10 != 0: # not end with 0 + ones += 1 + _int -= 1 + else: + _int -= ones * 10**(digits-1) + _int /= 10 + new_digits = get_int_len(_int) + diff_digits = digits - new_digits + if diff_digits == 1 or _int < 0: + # e.g. 514, 510, 110, 10 + # e.g. 415, 410, -90, -9 + return False + elif diff_digits > 2: + # e.g. 10101, 10100, 0010 + extra_zeroes = diff_digits - 2 + _int /= 10**(extra_zeroes) + if _int % 1 != 0: + return False + digits = get_int_len(_int) + ones = 0 + + return True + +def check_palindrome_str(_str): + return check_palindrome(int(_str)) + +if __name__ == '__main__': + while True: + print(check_palindrome_str(input(' >>> '))) + +''' +# FOR REPL.IT +while True: + print(check_palindrome_str(input(' >>> '))) +''' + diff --git a/challenge_13/python/ning/test.py b/challenge_13/python/ning/test.py new file mode 100644 index 000000000..3a4707310 --- /dev/null +++ b/challenge_13/python/ning/test.py @@ -0,0 +1,54 @@ +import unittest +from challenge_13 import check_palindrome + +class Tests(unittest.TestCase): + def test_given_1(self): + self.assertEqual( + check_palindrome(1112111), + True + ) + + def test_given_2(self): + self.assertEqual( + check_palindrome(1), + True + ) + + def test_given_3(self): + self.assertEqual( + check_palindrome(59112), + False + ) + + def test_given_4(self): + self.assertEqual( + check_palindrome(1234554321), + True + ) + + def test_given_5(self): + self.assertEqual( + check_palindrome(22), + True + ) + + def test_given_6(self): + self.assertEqual( + check_palindrome(1010100101), + False + ) + + def test_given_7(self): + self.assertEqual( + check_palindrome(1010110101), + True + ) + + def test_10111(self): + self.assertEqual( + check_palindrome(10111), + False + ) + +if __name__ == '__main__': + unittest.main() From a08b7e0f0b63e246db9d3732c8aaebbede09cb0c Mon Sep 17 00:00:00 2001 From: ningSP4 Date: Tue, 17 Jan 2017 14:27:04 +0800 Subject: [PATCH 63/95] Minor: markdown typos in README.md --- challenge_13/python/ning/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge_13/python/ning/README.md b/challenge_13/python/ning/README.md index 80113078a..6f5b18d00 100644 --- a/challenge_13/python/ning/README.md +++ b/challenge_13/python/ning/README.md @@ -26,7 +26,7 @@ A subset of _Case 4_, we detect a three digit difference, and the program contin 1. `get_int_len` takes an integer input and returns the number of digits in that integer by comparing it to powers of 10. A more mathematical way to do this would be with log of base 10, but this would violate rule #1 with its use of the `math` module. 2. `check_palindrome` takes an integer input and returns True if it is an integer palindrome, and False if not. -3. `check_palindrome_str(_str) is a wrapper around the above `check_palindrome` function which takes a string input instead. +3. `check_palindrome_str `is a wrapper around the above `check_palindrome` function which takes a string input instead. ## Unit Test From 7346cffd367fb1ceda0920e09797801d57763f5d Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Tue, 17 Jan 2017 06:04:27 -0600 Subject: [PATCH 64/95] [C] challenge 13(Unreviewed) --- challenge_13/c/karanchawla/README.md | 6 ++ challenge_13/c/karanchawla/challenge_13.c | 93 +++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 challenge_13/c/karanchawla/README.md create mode 100644 challenge_13/c/karanchawla/challenge_13.c diff --git a/challenge_13/c/karanchawla/README.md b/challenge_13/c/karanchawla/README.md new file mode 100644 index 000000000..8ae239cf4 --- /dev/null +++ b/challenge_13/c/karanchawla/README.md @@ -0,0 +1,6 @@ +``` +Karan Chawla +Challenge 13 +``` + +Implemented dynamic arrays and added each digit of the number, created an ```isPalindrome``` method to check for the Palindrome. The method returns ```true``` if the number is a palindrome, else it returns ```flase```. \ No newline at end of file diff --git a/challenge_13/c/karanchawla/challenge_13.c b/challenge_13/c/karanchawla/challenge_13.c new file mode 100644 index 000000000..e401485e7 --- /dev/null +++ b/challenge_13/c/karanchawla/challenge_13.c @@ -0,0 +1,93 @@ +//Karan Chawla +//Challenge 13 + +#include +#include + +// Dynamic Array Definition +////////////////////////////////////////////////////////////////////////////////// +typedef struct { + int *array; + size_t used; + size_t size; +} Array; + +void initArray(Array *a, size_t initialSize) +{ + a->array = (int *)malloc(initialSize * sizeof(int)); + a->used = 0; + a->size = initialSize; +} + +void insertArray(Array *a, int element) +{ +// a->used is the number of used entries, because a->array[a->used++] updates a->used only *after* the array has been accessed. +// Therefore a->used can go up to a->size + if (a->used == a->size) + { + a->size *= 2; + a->array = (int *)realloc(a->array, a->size * sizeof(int)); + } + a->array[a->used++] = element; +} + +void freeArray(Array *a) +{ + free(a->array); + a->array = NULL; + a->used = a->size = 0; +} +/* +Array a; +int i; +initArray(&a, 5); // initially 5 elements +for (i = 0; i < 100; i++) +insertArray(&a, i); // automatically resizes as necessary +printf("%d\n", a.array[9]); // print 10th element +printf("%d\n", a.used); // print number of elements +freeArray(&a); +*/ +/////////////////////////////////////////////////////////////////////////////////// + +void isPalindrome(int num) +{ + Array a; + initArray(&a,1); + while(num) + { + insertArray(&a, num%10); + num /= 10; + } + + int size = a.used; + + int flag = 1; + for(int i=0;i Date: Tue, 17 Jan 2017 10:27:42 -0800 Subject: [PATCH 65/95] Challenge_4 in Python(Unreviewed) (#422) Challenge_4 in Python(Reviewed) --- challenge_4/python/ajschrier/InvertTree.py | 64 +++++++++++++++++++ .../python/ajschrier/InvertTreeTests.py | 34 ++++++++++ challenge_4/python/ajschrier/README.md | 38 +++++++++++ 3 files changed, 136 insertions(+) create mode 100644 challenge_4/python/ajschrier/InvertTree.py create mode 100644 challenge_4/python/ajschrier/InvertTreeTests.py create mode 100644 challenge_4/python/ajschrier/README.md diff --git a/challenge_4/python/ajschrier/InvertTree.py b/challenge_4/python/ajschrier/InvertTree.py new file mode 100644 index 000000000..a2ebaec23 --- /dev/null +++ b/challenge_4/python/ajschrier/InvertTree.py @@ -0,0 +1,64 @@ +class Node(object): + def __init__(self, value, left=None, right=None): + self.value = value + self.left = left + self.right = right + + +def nodeDepth(root): + # Empty tree + if root is None: + return 0 + # Node only + elif root.left is None and root.right is None: + return 1 + # One sided trees + elif root.left is None: + return 1 + nodeDepth(root.right) + elif root.right is None: + return 1 + nodeDepth(root.left) + # Two sided trees + else: + return 1 + (max(nodeDepth(root.left), nodeDepth(root.right))) + + +def flipTree(root): + # Return none if root is none + if root is None: + return None + # Return if there are no leaves + if root.left is None and root.right is None: + return root + # Perform the flip + root.left, root.right = root.right, root.left + # Recur for the leaves + flipTree(root.left) + flipTree(root.right) + return root + + +def treePrint(root, level=0): + # Adds a prefix for indentation + prefix = '-' * level + if root is None: + return + print "{}{}".format(prefix, root.value) + treePrint(root.left, level + 1) + treePrint(root.right, level + 1) + + +def main(): + T = Node(4, + Node(2, + Node(1), + Node(3)), + Node(7, + Node(6), + Node(9))) + treePrint(T) + print "Here we goo......" + treePrint(flipTree(T)) + + +if __name__ == '__main__': + main() diff --git a/challenge_4/python/ajschrier/InvertTreeTests.py b/challenge_4/python/ajschrier/InvertTreeTests.py new file mode 100644 index 000000000..b9d6381cb --- /dev/null +++ b/challenge_4/python/ajschrier/InvertTreeTests.py @@ -0,0 +1,34 @@ +from InvertTree import flipTree, Node +import unittest + + +class InvertTreeTests(unittest.TestCase): + """docstring for InvertTreeTests""" + def testFlipTreeGivenCase(self): + testTree = Node(4, + Node(2, + Node(1), + Node(3)), + Node(7, + Node(6), + Node(9))) + resultTree = Node(4, + Node(7, + Node(9), + Node(6)), + Node(2, + Node(3), + Node(1))) + self.assertEqual(flipTree(testTree), resultTree) + + def testFlipTreeNone(self): + self.assertEqual(flipTree(None), None) + + def testFlipTreeDepth1(self): + testTree = Node(1) + resultTree = Node(1) + self.assertEqual(flipTree(testTree), resultTree) + + +if __name__ == '__main__': + unittest.main() diff --git a/challenge_4/python/ajschrier/README.md b/challenge_4/python/ajschrier/README.md new file mode 100644 index 000000000..72f739040 --- /dev/null +++ b/challenge_4/python/ajschrier/README.md @@ -0,0 +1,38 @@ +# Challenge 4 - Invert Binary Tree + +Takes the tree and flips it. + +## Objects + +### Node + +###### Attributes + +* Value - value of the node +* left - Node on the left branch +* right - Node on the right branch + +## Functions + +### nodeDepth + +**Input:** Node +**Output:** Integer + +Checks for the depth of a tree from a given node. + +### flipTree + +**Input:** Node +**Output:** Node + +From a given node, flips the left and right pointers recursively for the remaining depth of the tree. + +### treePrint + +**Input:** Node +**Output:** Text to STDOUT + +Influence from mindm's solution in this function. + +From a given node, prints the tree structure to standard out. Uses hyphens to visually demonstrate hierarchy. \ No newline at end of file From 2e48927f2327e2c43c77e34ed4875ed95c9722c3 Mon Sep 17 00:00:00 2001 From: ningOTI Date: Wed, 18 Jan 2017 11:15:42 +0800 Subject: [PATCH 66/95] [Python] Challenge #9 (Pending) (#396) * Challenge #9: Add solution in python * Remove ipython files * Minor: Add '#' to challenge no. * Add timeit tests to test.py, results to README.md --- challenge_9/python/ning/README.md | 30 ++++++++++ challenge_9/python/ning/challenge_9.py | 14 +++++ challenge_9/python/ning/test.py | 83 ++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 challenge_9/python/ning/README.md create mode 100644 challenge_9/python/ning/challenge_9.py create mode 100644 challenge_9/python/ning/test.py diff --git a/challenge_9/python/ning/README.md b/challenge_9/python/ning/README.md new file mode 100644 index 000000000..87fc3276d --- /dev/null +++ b/challenge_9/python/ning/README.md @@ -0,0 +1,30 @@ +# Challenge #9, Squares + +This solution makes use of `Counter` from the in-built `collections` library. The creation of the Counter object, `abs_counter` is an O(n) operation as can be seen from the [source code](https://hg.python.org/cpython/file/2.7/Lib/collections.py#l528). + +1. To start off, we create an empty `output_list` which we will append our output. +2. Next, we create a Counter object `abs_counter` from the input list with the absolute values of each element within. +3. The lowest and highest absolute values, `max_abs` and `min_abs` are found. +4. This allows us to iterate through all absolute values in ascending order, eliminating the need for any form of sorting after we square the elements. +5. Put into practice: we iterate through from `min_abs` to `max_abs+1`, appending the squares accordingly (taking into account elements that occur more than once as well) into the output, `output_list`. + +The unit test covers, + +1. Positive integers +2. Negative integers +3. Zeroes +4. Repeat elements + +``` +...... +---------------------------------------------------------------------- +Ran 6 tests in 8.258s + +OK +test_all completed 100000 reps with 1.8796267224919547s +test_negatives completed 100000 reps with 1.0380016055644727s +test_positives completed 100000 reps with 1.0510455415440965s +test_repeats completed 100000 reps with 2.041641256050432s +test_zeroes_negatives completed 100000 reps with 1.102484358268124s +test_zeroes_positives completed 100000 reps with 1.1347802273483003s +``` diff --git a/challenge_9/python/ning/challenge_9.py b/challenge_9/python/ning/challenge_9.py new file mode 100644 index 000000000..4ab62eaa8 --- /dev/null +++ b/challenge_9/python/ning/challenge_9.py @@ -0,0 +1,14 @@ +from collections import Counter + +def square_sort(input_list): + output_list = [] + abs_counter = Counter([abs(i) for i in input_list]) # O(n) + max_abs, min_abs = max(abs_counter.keys()), min(abs_counter.keys()) # O(n) + + for i in range(min_abs, max_abs+1): # O(m), where m is unique ints, then... + if i in abs_counter: + for iters in range(abs_counter[i]): # O(m) -> O(n), for all ints now + output_list.append(i**2) + + return output_list + diff --git a/challenge_9/python/ning/test.py b/challenge_9/python/ning/test.py new file mode 100644 index 000000000..d1ac4ee9b --- /dev/null +++ b/challenge_9/python/ning/test.py @@ -0,0 +1,83 @@ +import unittest, timeit +from challenge_9 import square_sort + +class Tests(unittest.TestCase): + reps = 100000 + + def test_positives(self): + self.assertEqual( + square_sort([1, 2, 3, 4]), + [1, 4, 9, 16] + ) + time = timeit.timeit( + 'square_sort([1, 2, 3, 4])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_positives completed {} reps with {}s'.format(Tests.reps, time)) + + + def test_negatives(self): + self.assertEqual( + square_sort([-1, -2, -3, -4]), + [1, 4, 9, 16] + ) + time = timeit.timeit( + 'square_sort([-1, -2, -3, -4])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_negatives completed {} reps with {}s'.format(Tests.reps, time)) + + def test_zeroes_positives(self): + self.assertEqual( + square_sort([0, 0, 1, 3, 5]), + [0, 0, 1, 9, 25] + ) + time = timeit.timeit( + 'square_sort([0, 0, 1, 3, 5])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_zeroes_positives completed {} reps with {}s'.format(Tests.reps, time)) + + def test_zeroes_negatives(self): + self.assertEqual( + square_sort([-6, -4, -2, 0, 0]), + [0, 0, 4, 16, 36] + ) + time = timeit.timeit( + 'square_sort([-6, -4, -2, 0, 0])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_zeroes_negatives completed {} reps with {}s'.format(Tests.reps, time)) + + def test_all(self): + self.assertEqual( + square_sort([-10, -8, -5, -3, -1, 0, 2, 4, 6, 7, 9]), + [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100] + ) + time = timeit.timeit( + 'square_sort([-10, -8, -5, -3, -1, 0, 2, 4, 6, 7, 9])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_all completed {} reps with {}s'.format(Tests.reps, time)) + + def test_repeats(self): + self.assertEqual( + square_sort([-10, -8, -5, -3, -2, -1, 0, 0, 2, 4, 5, 6, 7, 9, 10]), + [0, 0, 1, 4, 4, 9, 16, 25, 25, 36, 49, 64, 81, 100, 100] + ) + time = timeit.timeit( + 'square_sort([-10, -8, -5, -3, -2, -1, 0, 0, 2, 4, 5, 6, 7, 9, 10])', + setup='from __main__ import square_sort', + number=Tests.reps + ) + print('test_repeats completed {} reps with {}s'.format(Tests.reps, time)) + +if __name__ == '__main__': + unittest.main() + + From 7d9c2fa360992227cc88b305e9ee921e2452e6d7 Mon Sep 17 00:00:00 2001 From: rbrtdambrosio Date: Wed, 18 Jan 2017 11:32:25 +0100 Subject: [PATCH 67/95] [cpp]Challenge_3 (Unreviewed) (#426) --- challenge_3/cpp/rbrt/README.md | 3 + challenge_3/cpp/rbrt/src/[cpp]Challenge_3.cpp | 68 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 challenge_3/cpp/rbrt/README.md create mode 100644 challenge_3/cpp/rbrt/src/[cpp]Challenge_3.cpp diff --git a/challenge_3/cpp/rbrt/README.md b/challenge_3/cpp/rbrt/README.md new file mode 100644 index 000000000..084268536 --- /dev/null +++ b/challenge_3/cpp/rbrt/README.md @@ -0,0 +1,3 @@ +In this code we accept as input an array. We read it counting checking each element and +increasing a counter for each element. +When a counter is > than n/2 we have found the element of interest. \ No newline at end of file diff --git a/challenge_3/cpp/rbrt/src/[cpp]Challenge_3.cpp b/challenge_3/cpp/rbrt/src/[cpp]Challenge_3.cpp new file mode 100644 index 000000000..df345f7bd --- /dev/null +++ b/challenge_3/cpp/rbrt/src/[cpp]Challenge_3.cpp @@ -0,0 +1,68 @@ +#include + + +using namespace std; + +int find_max(int x[],int n); //This function read an array and give as output the maximum element in the array + +int main() +{ + int n; + + //we accept as input a value representing the length of the array + // And the list of elements of the array. + // The maximum size of the array is 1000 elements, is an arbitrary size that I + // believe to be enough for the task at hand + + + cout<< "Please insert the array length >> "; + cin>>n; + int x[1000]={0}; + + cout<< "Please insert an array >> "; + + for(int i=0;i>x[i]; + } + + + //we generate an array from 1 to the maximum value present in the input array. + //Every time that a value occurs in the input array we increment it in ctrl + //To know which element occur most of the time we check ctrl[i]>n/2 + + int *ctrl=new int[find_max(x,n)+1]; + + for(int i=0;i(n/2)) + { + cout<<"The element that is present the majority of times is:"< Date: Wed, 18 Jan 2017 16:03:03 +0530 Subject: [PATCH 68/95] Rust challenge 2 (#416) * Add main.rs to use find_single mod * Add test cases * Add print statements for more clarity * Add README.md --- challenge_2/rust/makernaren/Cargo.lock | 4 +++ challenge_2/rust/makernaren/Cargo.toml | 6 ++++ challenge_2/rust/makernaren/README.md | 18 +++++++++++ challenge_2/rust/makernaren/src/main.rs | 7 +++++ .../rust/makernaren/src/single_number.rs | 30 +++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 challenge_2/rust/makernaren/Cargo.lock create mode 100644 challenge_2/rust/makernaren/Cargo.toml create mode 100644 challenge_2/rust/makernaren/README.md create mode 100644 challenge_2/rust/makernaren/src/main.rs create mode 100644 challenge_2/rust/makernaren/src/single_number.rs diff --git a/challenge_2/rust/makernaren/Cargo.lock b/challenge_2/rust/makernaren/Cargo.lock new file mode 100644 index 000000000..e2dd7ff3a --- /dev/null +++ b/challenge_2/rust/makernaren/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "makernaren" +version = "0.1.0" + diff --git a/challenge_2/rust/makernaren/Cargo.toml b/challenge_2/rust/makernaren/Cargo.toml new file mode 100644 index 000000000..55e3673ab --- /dev/null +++ b/challenge_2/rust/makernaren/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "makernaren" +version = "0.1.0" +authors = ["naren "] + +[dependencies] diff --git a/challenge_2/rust/makernaren/README.md b/challenge_2/rust/makernaren/README.md new file mode 100644 index 000000000..fb05e5ea6 --- /dev/null +++ b/challenge_2/rust/makernaren/README.md @@ -0,0 +1,18 @@ +## Single Number +#### To run the code : +* Open this directory in terminal and run `cargo run` to compile and run the code. +* To test the code just run, `cargo test` in same directory. +``` +$ cargo run + Finished debug [unoptimized + debuginfo] target(s) in 0.62 secs + Running `target/debug/makernaren` +Given array is [1, 1, 2, 2, 3, 3, 5] +Single occurance : 5 + +$ cargo test + Finished debug [unoptimized + debuginfo] target(s) in 0.70 secs + Running target/debug/makernaren-bf4fafb462d1be5f +running 1 test +test single_number::tests::test_int ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured \ No newline at end of file diff --git a/challenge_2/rust/makernaren/src/main.rs b/challenge_2/rust/makernaren/src/main.rs new file mode 100644 index 000000000..2513e123e --- /dev/null +++ b/challenge_2/rust/makernaren/src/main.rs @@ -0,0 +1,7 @@ +mod single_number; +fn main() { + // let input = vec!['a', 'a', 'b', 'b', 'c', 'c', 'd']; + let input = vec![1, 1, 2, 2, 3, 3, 5]; + println!("Given array is {:?} \n Single occurance : {}",input.clone(), single_number::find_single(input)); + +} \ No newline at end of file diff --git a/challenge_2/rust/makernaren/src/single_number.rs b/challenge_2/rust/makernaren/src/single_number.rs new file mode 100644 index 000000000..0d73368b3 --- /dev/null +++ b/challenge_2/rust/makernaren/src/single_number.rs @@ -0,0 +1,30 @@ +use std::collections::HashMap; + +// Finds the unique character in given array +pub fn find_single(input: Vec) -> i32 { + // Create hashmap, let the key be the element in input array + // and value be its count. Then return the key with count of 1. + let mut occurances: HashMap = HashMap::new(); + for key in input { + *occurances.entry(key).or_insert(0) += 1; + } + let mut result: i32 = 0; + for (key, val) in occurances.iter() { + if *val == 1 { + result = key.to_owned(); + } + } + return result +} + + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn test_int() { + let expected = 5; + let input = vec![2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10,9 ,8 ,7 ,8 ,10 ,7]; + assert_eq!(expected.to_owned(), find_single(input)); + } +} \ No newline at end of file From c6de8e2ab99779ebf78c78df5a3e3ce6f74d212e Mon Sep 17 00:00:00 2001 From: D Davis Date: Wed, 18 Jan 2017 05:34:57 -0500 Subject: [PATCH 69/95] [Python] Challenge 2 (Unreviewed) (#415) --- challenge_2/python/dfdx2/count.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 challenge_2/python/dfdx2/count.py diff --git a/challenge_2/python/dfdx2/count.py b/challenge_2/python/dfdx2/count.py new file mode 100644 index 000000000..9f925d12b --- /dev/null +++ b/challenge_2/python/dfdx2/count.py @@ -0,0 +1,5 @@ +from collections import Counter + +print(Counter([2,3,4,2,3,5,4,6,4,6,9,10,9,8,7,8,10,7]).most_common()[:-2:-1]) + +print(Counter([2,'a','l',3,'l',4,'k',2,3,4,'a',6,'c',4,'m',6,'m','k',9,10,9,8,7,8,10,7]).most_common()[:-2:-1]) \ No newline at end of file From 07f88a63ec6a77de80779d8ef3bc40f64e912de4 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Wed, 18 Jan 2017 13:36:32 +0300 Subject: [PATCH 70/95] [Python] Challenge 2 (Unreviewed) (#356) * Challenge 2 in python * Added documentation and autorun --- challenge_2/python/sarcodian/README.md | 3 +++ .../python/sarcodian/src/challenge_2.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 challenge_2/python/sarcodian/README.md create mode 100644 challenge_2/python/sarcodian/src/challenge_2.py diff --git a/challenge_2/python/sarcodian/README.md b/challenge_2/python/sarcodian/README.md new file mode 100644 index 000000000..7c3f65d2e --- /dev/null +++ b/challenge_2/python/sarcodian/README.md @@ -0,0 +1,3 @@ +Picking unique char from list assuming list is given as : + +pick_char([2,'a','l',3,'l',4,'k',2,3,4,'a',6,'c',4,'m',6,'m','k',9,10,9,8,7,8,10,7]) \ No newline at end of file diff --git a/challenge_2/python/sarcodian/src/challenge_2.py b/challenge_2/python/sarcodian/src/challenge_2.py new file mode 100644 index 000000000..3e9734e96 --- /dev/null +++ b/challenge_2/python/sarcodian/src/challenge_2.py @@ -0,0 +1,18 @@ +def pick_char(array0): + ''' + array0: list, the array that is entered with one unique char + returns: char, a single element string or int that was unique in the array + ''' + unique = [] + duplicate = [] + for i in array0: + if i in duplicate: + pass + elif i in unique: + duplicate.append(i) + unique.remove(i) + else: + unique.append(i) + return unique[0] + +print(pick_char([2,'a','l',3,'l',4,'k',2,3,4,'a',6,'c',4,'m',6,'m','k',9,10,9,8,7,8,10,7])) \ No newline at end of file From f2c3ffbbd6590fda07039f32fb896f55cc2b7907 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Wed, 18 Jan 2017 13:39:56 +0300 Subject: [PATCH 71/95] [Python] Challenge 4 (Unreviewed) (#358) * challenge 4 in python * Added a function to make a tree 4 levels deep --- challenge_4/python/sarcodian/README.md | 14 ++++ .../python/sarcodian/src/challenge_4.py | 72 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 challenge_4/python/sarcodian/README.md create mode 100644 challenge_4/python/sarcodian/src/challenge_4.py diff --git a/challenge_4/python/sarcodian/README.md b/challenge_4/python/sarcodian/README.md new file mode 100644 index 000000000..14373f118 --- /dev/null +++ b/challenge_4/python/sarcodian/README.md @@ -0,0 +1,14 @@ +So I took this out and after a nice long slack discussion, decided to put it back, +since what I lacked most was documentation, which was causing a missunderstanding. + +So, instead of building a Node class, and recursing my way down, I built each node in +list notation using the format tree = [head, [left, [], []], [right, [], []]] + +The empty lists are equvalent to None + +If you want to add left.left, you simply add tree[1][1] = [left.left, [], []] +If you want to add left.right, you can add tree[1][2] = [left.right, [], []] +Same notation if you want to retrieve a node or branch. + +TL:DR; I did not hard code a list and reverse it. You can build and manipulate the tree from +scratch and the reverse fuction will recurse down until the null values and flip them for you. \ No newline at end of file diff --git a/challenge_4/python/sarcodian/src/challenge_4.py b/challenge_4/python/sarcodian/src/challenge_4.py new file mode 100644 index 000000000..5fbbed770 --- /dev/null +++ b/challenge_4/python/sarcodian/src/challenge_4.py @@ -0,0 +1,72 @@ +""" +Each root has two subtrees, each subtree may have a root +Each tree has the format ['parent', + ['child1', + ['child1.1'],['child1.2']], + ['child2', + ['child2.1'],['child2.2']]] +""" + +import itertools + +def reverse(tree): + subtree = tree.copy() + if len(subtree[1]) < 2 and len(subtree[2]) < 2: + return [subtree[0], subtree[2], subtree[1]] + elif len(subtree[1]) < 2: + return [subtree[0], [reverse(subtree[2])], subtree[1]] + elif len(subtree[2]) < 2: + return [subtree[0], subtree[2], [reverse(subtree[1])]] + else: + return [subtree[0], reverse(subtree[2]), reverse(subtree[1])] + + +test = [4, + [2, + [1], [3]], + [7, + [6], [9]] + ] + +def create_large_tree(): + """ + Create a tree with up to 4 levels of nodes to show that implementation scales, enter less then 15 + """ + value_of_nodes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'a', 'b', 'c', 'd', 'e'] + tree = '' + depth = 0 + count = 0 + + while depth < 4: + if depth == 0: + tree = [value_of_nodes[0], [], []] + depth += 1 + count += 1 + elif depth == 1: + for i in [1,2]: + tree[i] = [value_of_nodes[count], [], []] + count += 1 + depth += 1 + elif depth == 2: + for i,j in itertools.product([1,2], repeat=depth): + tree[i][j] = [value_of_nodes[count], [], []] + count += 1 + depth += 1 + elif depth == 3: + for i, j, k in itertools.product([1,2], repeat=depth): + tree[i][j][k] = [value_of_nodes[count], [], []] + count += 1 + depth += 1 + return tree + + +print(test) +test_rev = reverse(test) +print(test_rev) +print(reverse(test_rev)) + +test2 = create_large_tree() +print(test2) +test_rev2 = reverse(test2) +print(test_rev2) +print(reverse(test_rev2)) \ No newline at end of file From 0acb50ef0f55385c999ded2779d96dcb2b6e1f5d Mon Sep 17 00:00:00 2001 From: JakeBash Date: Wed, 18 Jan 2017 14:10:29 -0500 Subject: [PATCH 72/95] Challenge 0 Completed Completed Challenge # 0 of the 2017 Year of Programming Challenge --- challenge_0/java/JakeBash/Challenge_0.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 challenge_0/java/JakeBash/Challenge_0.java diff --git a/challenge_0/java/JakeBash/Challenge_0.java b/challenge_0/java/JakeBash/Challenge_0.java new file mode 100644 index 000000000..8e82c3441 --- /dev/null +++ b/challenge_0/java/JakeBash/Challenge_0.java @@ -0,0 +1,16 @@ +/** + * This class hodls the code needed to meet the requirements for Challenge 0 of + * the 2017 Year of Programming. + * + * @author Jake Bashaw + */ +public class Challenge_0 +{ + /** + * Prints "Hello World" for the user to view + */ + public static void main(String args[]) + { + System.out.println("Hello World!"); + } +} From 9a62d0ed33dc87392ef689bb1c8559a3a6e4032a Mon Sep 17 00:00:00 2001 From: JakeBash Date: Wed, 18 Jan 2017 14:12:21 -0500 Subject: [PATCH 73/95] Challenge 0 Final Fixed a spelling error from 1st commit. --- challenge_0/java/JakeBash/Challenge_0.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge_0/java/JakeBash/Challenge_0.java b/challenge_0/java/JakeBash/Challenge_0.java index 8e82c3441..256f36365 100644 --- a/challenge_0/java/JakeBash/Challenge_0.java +++ b/challenge_0/java/JakeBash/Challenge_0.java @@ -1,5 +1,5 @@ /** - * This class hodls the code needed to meet the requirements for Challenge 0 of + * This class holds the code needed to meet the requirements for Challenge 0 of * the 2017 Year of Programming. * * @author Jake Bashaw From 2883c360ffe0f9959faee9aa7cd19f36ac4f86eb Mon Sep 17 00:00:00 2001 From: AJ Schrier Date: Wed, 18 Jan 2017 11:56:50 -0800 Subject: [PATCH 74/95] Challenge_5 in Python (Unreviewed) (#424) [Python]Challenge_5(Reviewed) --- challenge_4/python/ajschrier/README.md | 2 +- .../python/ajschrier/FindTheDifference.py | 21 ++++ challenge_5/python/ajschrier/README.md | 9 ++ challenge_5/python/ajschrier/test.py | 95 +++++++++++++++++++ 4 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 challenge_5/python/ajschrier/FindTheDifference.py create mode 100644 challenge_5/python/ajschrier/README.md create mode 100644 challenge_5/python/ajschrier/test.py diff --git a/challenge_4/python/ajschrier/README.md b/challenge_4/python/ajschrier/README.md index 72f739040..c414fbbb4 100644 --- a/challenge_4/python/ajschrier/README.md +++ b/challenge_4/python/ajschrier/README.md @@ -35,4 +35,4 @@ From a given node, flips the left and right pointers recursively for the remaini Influence from mindm's solution in this function. -From a given node, prints the tree structure to standard out. Uses hyphens to visually demonstrate hierarchy. \ No newline at end of file +From a given node, prints the tree structure to standard out. Uses hyphens to visually demonstrate hierarchy. diff --git a/challenge_5/python/ajschrier/FindTheDifference.py b/challenge_5/python/ajschrier/FindTheDifference.py new file mode 100644 index 000000000..d40d91cc4 --- /dev/null +++ b/challenge_5/python/ajschrier/FindTheDifference.py @@ -0,0 +1,21 @@ +from collections import Counter + + +class Solution(): + def findTheDifference(self, s, t): + sCounter = Counter(s) + tCounter = Counter(t) + for i in tCounter: + if tCounter[i] > sCounter[i]: + return i + + +def main(): + s = "abcd" + t = "abcde" + a = Solution() + print a.findTheDifference(s, t) + + +if __name__ == '__main__': + main() diff --git a/challenge_5/python/ajschrier/README.md b/challenge_5/python/ajschrier/README.md new file mode 100644 index 000000000..ab397f0cb --- /dev/null +++ b/challenge_5/python/ajschrier/README.md @@ -0,0 +1,9 @@ +# Challenge 5 - Find the Difference + +Counts all the characters in a string and finds the added letter + +## Functions + +### FindTheDifference + +Creates a counter from each of the strings, and compares the character count. The one that doesn't match gets returned. \ No newline at end of file diff --git a/challenge_5/python/ajschrier/test.py b/challenge_5/python/ajschrier/test.py new file mode 100644 index 000000000..c46f34379 --- /dev/null +++ b/challenge_5/python/ajschrier/test.py @@ -0,0 +1,95 @@ +import unittest +import time +import random +from FindTheDifference import Solution + + +class OutcomesTest(unittest.TestCase): + + # Simple test cases for this problem + + def test_case1(self): + case1in = Solution() + t1 = time.time() + case1out = case1in.findTheDifference("abcd", "abcde") + t2 = time.time() + print ('Runtime of Case1: ' + str(t2-t1) + ' seconds') + self.assertEqual(case1out, 'e') + + def test_case2(self): + case2in = Solution() + t1 = time.time() + case2out = case2in.findTheDifference("abcd", "dcabe") + t2 = time.time() + print ('Runtime of Case2: ' + str(t2-t1) + ' seconds') + self.assertEqual(case2out, 'e') + + def test_case3(self): + case3in = Solution() + t1 = time.time() + case3out = case3in.findTheDifference("abcdefghijklmno", + "abcdefghijklmnop") + t2 = time.time() + print ('Runtime of Case3: ' + str(t2-t1) + ' seconds') + self.assertEqual(case3out, 'p') + + def test_case4(self): + case4in = Solution() + t1 = time.time() + case4out = case4in.findTheDifference(" ", " ") + t2 = time.time() + print ('Runtime of Case4: ' + str(t2-t1) + ' seconds') + self.assertEqual(case4out, None) + + def test_case5(self): + finalTestStringS = 'yipsqffxmqafnrlnkwrnvspeekejbsuuvuhanlxmg' \ + 'kyjlgmloxmpyxuvqeabmycqycwkzvhyviaavwryyh' \ + 'tepqacfuzggcoctviibhbcwzmkbsivtjywienaojk' \ + 'cekvgsyylliasczuzoivipcsqknbshavzwyufkeax' \ + 'jiunbyiuvxvpfokrfphcxbaljktkiygrboihqczhx' \ + 'nreigzhsinustzzrzstbpkfrqsenhrnkrfbekfwao' \ + 'zenxqabbhhsaxyrubmtzmvtclatncfkkvplvuwzfg' \ + 'gfnprinyjblutbovtmxxvacouiwgrkgjvszkwswvn' \ + 'waggsiwzymixwmhmujmuckgyiwcwrigtshqeuguyt' \ + 'pjjsrmijmxikeraqqgjymbvmvcugxubuxmlzoiqzf' \ + 'jwpzpqnwalcxczzxaitpmjsorwzmwzgjcgpztaynu' \ + 'jqqmhvyscupqjflrnjqseeapavmakvexuvkntgcvk' \ + 'vonjqoivimybahutpjtzubamihhbyhspgtmjwexyl' \ + 'kqqjvmtpxxcjnlpbkaiiekjlxkrewthipzhfljcfy' \ + 'uclowlptfhksrngxpzijabhfjhwtlbfuouqskheyb' \ + 'goqinmhnjzciqvscvneokfqrghekuzkahlyosemcg' \ + 'qipimjaypxkkwvtqztcexlhogjqfxvfihqqcriaim' \ + 'ioaezfrbaxwfuwbiylpztmxovutxwhqrlrxfwpfcp' \ + 'pazjsztewupvarsqcizlneiomljrbufbuhljmgnlq' \ + 'kofsersqhfucsvfswqxnmqlthjcopeaseqmsghvqp' \ + 'nmxmuvuoteoqsaneknirsjrleslfsiceoypypbijh' \ + 'mtmesxpxcurnxjzwjclcesyfmffbcsxvnlhtnmwgx' \ + 'aywahyhqqfuevmwhhovxrqsslemlpxeiuqipmtqme' \ + 'qosghyvgyexblvnsbofvtjqfhcowmfvhyyerktinh' \ + 'ggqamtykvntxyywn' + finalTestStringT = ''.join(random.sample(finalTestStringS, + len(finalTestStringS))) + finalTestStringT += 'p' + case5in = Solution() + t1 = time.time() + case5out = case5in.findTheDifference(finalTestStringS, + finalTestStringT) + t2 = time.time() + print ('Runtime of Case5: ' + str(t2-t1) + ' seconds') + self.assertEqual(case5out, 'p') + + def test_case6(self): + finalTestStringS = 'gxtjprzwtvcouwkeiolonsrijhsajpohwkusigzntvwgpqxppqrvxmzieqvfemiakfuakrfevgvjbfssenotnhmigkvrkjizsncfcbcmkynavxtiuhkoinsyocreohxmgrbmilazqxpxthemhvfvafcbbtpweivittjvvomfewmiznohflukxptwuikouwcufjyjbhqfibpttsznrmernupssimsineiuabomsfmygpkmluynxyormlenupaxryjykfmhahuxmmhclrkomfkeqmjqponrgrhqnpvlxelsnftojwyvsqzegfaxupylqaqfabgramcaqfcmolmicollputqyhqwkxbnaqalfqckxrkhxkkvnyhuozytojtabcxtjbmuuqpjzbpaozrmrpoohwjyhisirbrsgorunsxsaimangvqxcszuuettxiwcnripmtykijopatsrusjupolrmacravejotqlglzmbrvzuymjwhzxruvjrxqlpvjcubagcmabgpschaiswwoaqstpwiirnyurebooubwzqgitfallsiomjcrpientnzzjafaxschxnbbslovootsbzykygvypycfkalsjsocmxhztolfebjfqbnzemkflfeymzlpgwpocrbpruqmjhjmewlzrcfgxhvzqcomppgiuhhoaxxyrmksyrsqsjwiqxtfzegboelnptvacgxpvlvmljgkkmzjvjltqraszmesmtawlarritbbhazyjtqgmnarlorbekxnglpetmmgttnjhmnrcjlwrgscwjifgoocmqjznzzkjxxrkqnhvewljibtfgeefyzmgomhieoqcawmxzeqvbcgxjubqsnbwlozjewnwwftktkwkgxqzsuwvnvefferivjabmqxurbfwtgegmewsbhzojntjhibxqbisealvhukhuvpmuqplwrsseixcmrkgmkglcrazgniivsxkkambpeyetsmzznbyosojvqpcztcphbowvtetxrlghcgfbwannqxlplcalvgynjnqftwfwgnhkuveucroefmeoqzqevzqkgerccoeluavrelbtprvwotxmbkojhlabftuxvlrtyvcrrnnixwxgasfquhzyuyfgtttcauzijkylgvsvevlmujrwqwijuiqphgpoaxgspcqnrnnretuskbguzvjzyivwseaopzzxrnqinefzoebgrzenlrqtkilswsijzfazokeuxazaqqsrelkvbgnhcgquotchkncyipnhmistuutvqbawbyitxcufpzjlnvrxxjholqkzgcejbtngwopixehkfewkkallshkbrtczwvqoahopctftugflkepapqvwaetguscutsjvhkpeiniiewobokpmhpileyualjkvgnnssljkvrxzfjvpaegntfrczjgkuttwwnfuejbltsnbfbgirlgrficztljaffzqvicbhinqqhlfurnjwisqeymilgkyacsibwysxzufksqapppoehurffiutjnccgeyoyeneworcaxkbofscougvrpkvecyrqeyysjnhvxkcsmzjcivwimlowzyacjqujkszpxkxgjglqweftqrasucfjeczqhocgylcwfnrqbttsnheaxhhmsfgzntcgrgcefmcbbkowqvlbbbhwsinhlxjiiisujfzagueaksuhwfejivgboylinskougvepmtknrqlfzhxaeinivrprwzxxoigmpqyxuvszpailszflollfholfvfmbjouiiurpmfpbbgejhehunjzrjalycnopljfvbuolevzwttqbgunwxklppccltmllwevtqjvzmqabhcnyyurgtkqbwwbgpnvzpzxfpcomqckvqqqicgowgiphapavyqqambfgowgnzfejrqavgqyvetgjsnkfqzrqfysmjvknfwcrcuhjmsqakilakqutmxcgyziutqikmhytanprafvohbizebmepztqpgeqrfpxvxrsjecibkbrcogrkqulyvgfjgjaypgfthqrbnnirojztbsosxktovrxzrrtlmbprhcelclrsphetxfussztlguxtyrbnnyfgiprtfncpmemebxobblmbrwnmaxzyhxijjizsiwoltmkwzqnlbrbrhopoaahvtljnanzymriqklyerzysrujkjoutuuvmnnwnywcreeguflrsufucvrjycpqastrmqhixzoatmqcvbiqexxbefkjssqiphgyrlhtjgmsusbnypbjqfbpljhrqjvvzhfmpuyoyenaumjnuszcoxyzgchrvfaejieoevvbimypyaamnilxtbkvmzfnofoqwhymjjjxeoyfvxqmlyangzualsjogsfrwxpwixuptklbzkukarnscuxaesnjrhuwuqrtlolgzorhgznbvobgchrmtfcgqqkeylqbnqzmuesgbjmfaozfhhfoysxlroqlvpgaaoxmlrousscutkuznylmciqhbatmrytjfaetfxgcxwshhmzpghsokqncorukrfpwyhhcztckzuwctoqxjbycyflexslqpilevypgczfvyxbvqpjsrnsylzjiffpzzvqfvxonbeqlblsfhqxpzehzlssuzyecvkkewjbrabsikictffakpyiwtwztmwotlwugupbsmzkajelhrsmceclacpxupvfbgbbrfthkfbloyumujcutgrfptmuwhcpxlwmtpjccbrfkhsysytztzgtfeonyzayaqzmybbqpuxkojavgjxxeabgnmqwphkhuwpysvyuhvoykaemycpzlwwabnrxxkwcgplknfyxhowllxbjjuhfjkfzmpgglauksazjfqlomluqqzecnugatghnygrlfalynqblzunlhetgugimqvffbcwfvbwtitclbgnpbcpaqfyexjeicsqsqfqqfirlopapbsigekbklyblxojsecgbewpmtggqcetitsrxvozosphjxcllgmfanmuszevrrnsaixrofaipjnhielexxhxysfzyohetglscczymspgvvbceebuijhgshqjfnnmsxxtggrrnzwkcpgkyjyqevxvwyuymomzmkhqoqwzkeljoxzjgzttiqsgraybkygzupapeetcemwviksiqlitgshccucawgjtmntmynflrsmasbxcuvahkstufveatvmmbbagmvuphqnughpnffztrrewjvxnsfhjugmxwfefrapffgazmtoecpltrvnapvkwsxtnrqlgzqymfycpkmwtgkkothuquafbxovwxtreeoinjlgoavebstbkesajlujvcmprucobjljpbhzxtkqkiwaggurgijtwvhgsebchbaweahjchbmmouzpahnbopvlalxaxxyfyiwtpnrvytgjazpgtgfblnytecyvknxuuzgoyowboqqtgubjweiyrwgfbeukoaptblvzbvihmuulpbaxeagqthbegquxliuasxapmperaqtyafvttevvasizqzctepjbpavmlycqonrahfursavytirzlyjvpvmpeioaeebwtgxunmnlmuscgcqgmpklwkabrotxfveomimhaylmrqmyotzymikqfnhpfetlaronvtyvfwqmjtywqzwyqvqkvkpcopzkefctbxfvqpnnacfgafvmvbwugyznkafygpubjmmqhujkvvbotlebykytjfjrjhwrstliribbkzcqiexgxysfxnieqwcorgrcwqcyvkulbcnceusrekfqwetxybxktriaabbjhzhflluabaklpckujegptbafpogbtebkcjofmkhvjufarwujcfgzvfmgriyithveypbjnivvfzvymptzcolquszvqvpubamasieobgcywywyunfqfgcqtifvvczmhelnyltkjimevntuuyplqecxhzzkbbjmtiqncmbnxvtpmjkearpthnvwuwxfyteiyezqixuzhlhlbfcwhwsnuubwzfmeaepjamfrennflngbyfggstuzigitytfrtmqaorhuoiqtwntzotgofbfashibvxwvwbnmbgxrwqayfsmmvqhqjoskmahthopsznxuejrmfejuhhnbiugkczpapqchoglpsggixkzysnxfpmvpkzezntygfmbenqwkejluefphmjmbbqzunzpfbxnvmraexbpuzvotaqbukirigxcuohqlvovmlkcrqchfbmtsxcqvwaojlwlcsmeviyqexwvprenyssssowvaqfcrqbhhibbjozagrnqzoushkocsctnylepotxbubzrcjhmapzfakbrrewbscgubaqvofwnbfvmsylfwheueyobaiwgvzwkknqsylnfufszmzmpefyxenfksxoizjkfkffnkbvvmyopolaqorycvtvacckcwyejfcxezugwbpbiywkyqttzjttqanuoxsgwnfrnmowhrrgpmyvngrzfnytcnuscontonjwmflhxhgfzrhtpiooghsmhgkataofisoajsquqqqcwovnzfvhjimecxwinzphxfcfcwlckmyscxiqczbeohzhtqsozntyqfneriucaoukbwncuoggnmicsnjttajzyyblftpnhzzhhqfnwtleiaqmwawlvivczmutkfqkumqsqrusmcoxotwarvpibofwqqshwrzlrwvsqxpbrijfipbpazrjojxfenirxigqmsetxcxtkxwukqkawmjqryypjvgkzeixmoetumhtrxtbhgkigxfrrwgtirlpemtmenlrokkosmuouhqwbmxtvsqljtszbzqryfkpvnkjrgpucotbepwoaksvlmwpfzfxxcpkomqhrotrzwjhslyktynfbaxuihvmqktlurcbhueewpkhpjissxqghegqonissltqxknbwtnuhbzwsmrpgtwuuvosibgpjohcuygaarjcjzhkkcrxzjkinsjgoepnctltetjhzoqeeopywgczemmsoxtbhlorlqrzzxqqutwwuowelulptixwgwczrbvbszjwawjntmbvhyvpuotgeoucjhzwmzfmltpnswptohqwjzbvfyzlllpanorcazemhqqsnocevmuuzchsaccvithqbsagmxsjhkhhkylgycnujabelrpavsehppbmcsnshvikompigameprrqmfrqnmirkjvfqzpwsuegceeaqjnmiyvpgjtntnlmfzlgtkkrcgzwlxnevxnkwnovmjthvzohzqykxjubtgbajepkjoiyrlzljqyxoxxsigagzylvgtsaufftoslvlhtbfxcxeopuoiwqsicbmwpyagiqlagzjewntpguthluvrjflalxrugfwikiutawxpweivgalupynqmzbwexorjyylqhwcqynnyielfofjgmmufxybkgiqzyozjufpohawxlcpfiltsbsairsyeiuuofhywahklwolnwgiupnsyasizaaiqwexpbetjzzzjmeatjfehqgkxkknuoekhszlljktkubuzskiwebzbinccyxgcrqrnxncngjlovsolvhwgupkiyuenplkgwkerqnsastpgthcyzgtqunyxczjyatwtibnwntefnftyjeojmfchashlziqftbkfpqqqszraywioaypaogxnrcjnmporvcnhpopyoutziuushmtfzzpofahcsvjypmuprgyiavxmpcmjkbitfazgcaorrmphhjtgxxllwnukwbhgwhxxbpqshezegribzipssvqgzysqvwtuznrjomvusxyguqjnkvrscftaawqhtjwsesoqsvbxypkccvmzvhonhihspbgsghbqqfrwvxlihjlsiczesxwgzsfkkugirecymmweqyofyxffmgxtgxpqwykgqcfjtijjzuxktxjeeyinpvvsuzxtfrqobtnyabgfpvjqrkyxhvchnijjgyesvjawtcwqacatkeegzftzahjthtqruzjpwjzcbfgsiqzipurmxvjswktbgixwokbmuinessabfjmlklxnrorzvaobehzfacijmbjwruiwkgmbzkpnuebgpiaslvybipgnoibnvqqzulamagsrcnnvgeaaolpnfmfflqumsxarflgmsgbicaposvaoafyalpelemwwhmisvblxzvuvtbfwwupgeeiamwrklgbjwhqmpqyfvbaktybtpasgkzslbkhjvmyfahngnolqpofzhgriljtptczmhefrhrhjwuqsiqozolnncpigwrlxtrimlgyzfysfechllzuiwqoojfbicghhimqlhlczzueybbpcojsnitejuqtlgzfplhmxghzptelrhmforskzrpkqofqbwwobznarimmmzfzffrpsimrlghviuilyryaqmqjimqelzzmzoooiwbimjlqarkymbtasvwxorrbxybwueqqxgklvoysktvflmfgsxwnxbyopocsimqhpzwaaxxxlokxpmfbgjaifcevoulqngntbrulpxazfyoqvpugzscjunprbzjyupsosnxyavhzsmztcozqxcygrpemhxniqrcuvoymmflovqgwpljtpxryksjnqgljokbrkppxmtrajselzqsmkyefseieujusxgkcgsbaatuwtpynbeufqpzjyzylhrswmyzczmigeywpxqkamohbvvrspqmymkbrnocmbtfisreavlqoozpkfgtaecanehptsmpfhomspwgcafvaupebqvqwaznvviiafahgtqtajjhyywgirsalratcksijfhaxxwrmfkxvvmtrysozmnayjxcjaiolokeovslolffmcqynjagucakkktiowsnmzjnkhkjbthzpeuhsivgskmtyrgxfnsriarpokpsycktbikzyulsshkzwixebkajleceysjqoqgoluirbvbkbwbhnletnkuooyryemogkxeeycfhjpmxumhevpxlxapjjbfbkqqeilfgjmzntzbhmqrezbltwjbpnfighwyovcjrltgoqzzfxawhsranwuhlcvjwiiykuleqlafyoqlsgcxqymiflcgigmcghkywreyjvvqscctzmbvvurwcmgxokpmmkurkgfxjcfazqfxcqtrosnhaguwmztghejohjcpbtrgkvyanrbqbglvqmovqqvnnalbyawvbvpbulflcmlknvyoctylxiajurkhsrqvsxcvapuerrtyjfjpzyyyfqvjfghbsllpgaashngbnrphhesbycpubhzvpfakfotqhcpkkqufsfgfvxmfapgmntzlpoyimjjhnqmeigeaglbcwivwnapgpthxikspupxkbsvrakgchahhwsaphupfgcmxizqvzltzufkceifureuyoiglrcpvaipthzzrgctbokkkzqkiuegbqioymrupltmmotbcorpfccbnzewoeuauoqcxajliuzxwjgplqkoojumlawyzqqiastsbqlahrlhpvczgfuygqggaijeswtkrayrlsvvnlvzqggpukreffncjcarvzwbhpqpvqxbhukmwtyrbbefmeryzoqvcithqxrpwkwbnggbinnbkhgpjlpcjubhelotgwvatlcjqlufbgpaxgrlewfxgrmjmuophcyglgjugjwtvscfahbiqxksbwjukikprtfjmixcwzpjbfigfhknitniismvclzixihzpkjcrheqvvipktxfbpeuqpkuxrcenxlotlhknipysntkscggplkfiumtqzagcfpxzvwqqagijmwvapuwkapczxtynkygtvhxjzwiotvqqlkiyntvqlumgrqpfjacimgnehnfjetnleqlwoxlbppvsxxyzwxqabzfxamlnnlpsktlazwnztqfqfnfcqpnscyisrvqzhofrwrujtorvjfjnjnsiezgmmuyghpclzxrmkqfhvppbvnoueqcjlqklepqjcvsblxoetpexexiggwhojtxqxanreryfeajaqzcicqpvktwqwgtkrhqvplkojqbnkohkevnsgbivnppjmbjrgiwwzhcptcqjbgmsxrklqtwojpeqyjvfxvtxhtkghghjygvqegsxnfzviimjhpgjcmwuwrsiwjgtqyunwpofnomapbwcezenvzpopphlmtpeznfaeqynietolvktcgqiyfvttfgleshbvjqabyxcvftifqgkulsubezyuvhwlxxvrjlfvsxreueycblnoxjwjsayubhktkjugzlspxtkvawcziikurwfilmiolcsbrhxjlfrqyjaquglnnhtmehizcqpakicoqefjuyixxmwyvmwfinvlwylsibnauphgcsmwykhcyipteqqkyrhxswvahubgvoyjulboetbzgotesxwuomrqyjmkiqnrcgshrwoaporeqroihubygptuatigizacsbqpxcoyiiffecjnflmewhxrzjjovqzohlpsigmxnvhvlhurfergnflwlbmhrkgkwtmwioxwfqqnmcbrqeacfzqtcphuhfzhxeaocbavlrbumqpmkyhncepsccwbbpoaarnarzapaofgykvzastvagferryzmvekpmxcosiezilyebvovgfyefleokwsqwnrbjlpraisumoymxytjcfjnhsbscfggnkqjvteeitoceefkfqfqsbhsgifxhrhqbkblvrinncfktfjcccghyclofixvjifckrzvsewrbzsjimuazjpqctjcnuqbwtvugpghwkisohxqwtmoqoxyfnhxwibvysblamlbjpfwrivawxvmtqkjzwolhyscmqxoecvqpohmbjsrtvqwmquyqtpwbwsngzzgglyhtmfzpkevuokfvjxgfgykyybqpkelkwhicbnmiikxhzixsirvihxbswcyycgozgrfpnbxvgwlgjivvbiwrqjgiyrabhomnrstetqioglbpgfwgrhxbsrieqjblqyrpbjyunzotjvmvqowxmotexkqembxfjnpowxtgwxpbnsjlsqjbujewbwxvjbppjlvyfxggujtbkhmfxjzhsrjlnqyizizyjttvtwsjtxbtrsgxyqqeakcajuebqsjjazpebszlsmrlkxmoyuuztbbrrqfprhkksphgggnpahrhnmznbhozcrqkurmftxzrbmqobuvuvwpguulkbmmcgvqobcbilljumbhrtzjtswjswauqnnhrrzkjnihwriercowmeshahkoqzrunkeeexpchmgbcuphhlukjzyrvcvtaesbneetreyaytqvtwqxrkquzqoqvmgghtmhnvvywjsrbvoviquwrmqjappxmzqbkvscvqayhvpxkvjgusajnslwqhoknvgooycmxpbjuuyxvpocazvgwkrxkllwuwhkxqibasesksstyelhnpvvqfajxklgyuceanbnnrnjvtyoiwkyqlgaenlugrltsvokmunkgrxjmgazaapzzqlxwsacyicpjcoonykztrtskzjaqxouhmzmwgfivjzigrncwoyjwwpjxwasewegqjlxcsmblpkbjeqplqutiartlgnekqkjenhvyowalymzlknqoguryyqogbgkfoshsbqyergszgjrmiynqfpghkvnzoxygbwmgvafxeaqpmstbzpkcfhnsxrfuaeqybtufesajkbyfqctjfjrxxoiwuqxrrgtyieqegneaqlztxihlqtbtmujyvjpsyekuojqiugsjqogvjbamxescbtngjwehgyomnrmcqwhvqgmmzxvfkrhliuobubwpueaefpfmpnieiszytavsbsrlnergfkeesalokmnyouwqrybmerhylbyfpwoirwkzqcxllbbjvlxoukkkleiehowtftjronnzewxyrykayzuvopevcvqyrbifcoqlbcnrevyopyzcwqhnjhequmkbjameqviwkovjyuqryjpveqjteeztouxctmtmirtsfuthgfewlflglzosapgtwaznjwypgrigntkmammcryrxvhnehcbipzfyfqsaqmukcejzivvjcfvsqetoxhkmkltinuwnwmpejvvxohczpgzeyvxhfbmarxjtzlvarbvryhyxyliwobtcbogubfyqflowebjwwkyflstgayuvaizkmfjusgefuvgtulqshbagemunuttviyecgvnqzwthffyctjmjzunyylipaxjpmmsucmcbmwiwhfuigwbvmztvorprzbhknoqkbwowebcjwagpbspibmqupiyfyiyvwjqkejrqowfmklbbsarwysbkwueueiuqhtfgfjgphnfkmpscuhsewwtorcxfqrvixlwwlhxxkcaajtfirjlrxnlvfxjlwvfhxhpxsebjuejbzhsaploxxlnentataugvwlzfxhjhtjgwjibsrvqfiftxgoylqyahrsyekippflwncwqhlpgrbhprxvhmeltuqxpilzcmjinxqmovoryhuxtopsyvfztvkinguicgjhmowcanqtwocjvotuvnbnsaiifnxtvywyjxeqwttmimmezwlkfxntbbgfcazfwtmxmnacmsrxxjczokbmiwhlhltohizkmnsehowbknjsjooxppsyvucpjvxljhreejcjczfsyaxzvbuckbauojacaxqjurchjscwyafjofyklbexmjqmrjqnfglatgisrgfwshhvczzpwrbklrgynkauwbrxhokpstuxrviruastkzchxetwgtcaieugkgjmbikbinemicwshsiweevvlmgcvkjtoyqukswmneecxiwiuvkorxkqwulofesqvsmsesoonskbnbzlnbcuwtanrxsmfspmeenuazjitknjpppubsyrqjmgksttbeoyheigbbaoqvmiprqrfwbgjzsviroexabvriozxjajnrkalqwuzcfvzjnyifmfaqvinvhhwoaryrsuzihkskibcrxjjqxjxaaypaoatptmwkozhnbagpgyijwftobpxmznnfecsrvgryhfgcgxwfmmxlmybaetfesvpfpzfaehpzhmcyltsxoavcmwzkukooktkiahpufbsisnmsozmmcrapisujfljfszkucgxxurhhmrivssmjcfeefgnaxencnqwcbqeqezqwtthcersurhcqsrljnfwvmkpgstbfarqlvmgrhthlqgximbgackltxwhofojvspsuwhzqfxteqfxbgfnoobusugwfxcnhaixrtskqslmquowssqcewqehhaqfiogrkaxjifmyglpzpesxvrhgrtbouelgxlmsxntsthfmvrbawanfkrbcbzztnsezggyxmkgmvaglovyzkiyustucmcrjlhspfygokuvoauizbbguafwejbxhlkvlmxpteswajpjhofchlcwaklxsfpghmynpjlxxeqgafpvnqmctriwtarknjhlcopkayzosjztmvyxbrkpxvewhwlhscjvmbazmkmeaqjfakfbwffgyxfukwpsqiookzpxubwpnfuzriprwaoeophvitwqxwukecjotoewpgvflfkrraaqjbkkrkgkfzitchvljokxarcnfxgwaqpjcevcmzkiywjeoqigeaqrxnjqhgnnhgknwwxkthbphjpqxkzlnewxwkwlqghbryqkcsfzikayrfkbojjzywkvfsxicmuijlppjgugbvyncwuembzjvhqovffcizkpezvgkzpstrgubmicexnqsxzvjtpujxbfgititqxghfblvzygbgsfuakvleopixhbphjgjauhomfsgvpxcyvnnoghiyovrzfgmrxuwyrrkmunjfatcbbinbexjcxzwqnpeenshupugswaghsfyrbaofpxraxgzkxhfulbtkwqxtejkcrzazbptmuilqqyxczzpgmntyfekswsnbfzafayzantclwfzkmtkbbormhfehznfghklvipkrcrlsqxkhtabbqthwljyfbveamvwioehqrtecqfhqfnrzvepjuyexxrbnxsazmwvormbsreexvknxwpbmpnuqjppxebtnkbsrmtzycvsgccliwszyqmwrirolmzuvsnhzabhhsejcjqlhnrkktfmsogfhtveclmvznansvwcbwiozfaobryqxjitkxnwozqkusuajnvnpbfntumlbvzacuouigpggcabjszrrotcqxqhjbouusrkxcctzawignvfrfhoyocnfrlsssufnqucebvxwvqlgctopcjqmkhxzwukinwzuwwjuwhlghbzfsfbunfuzuiwsfpvkewfuhmomrskvhwgnwtbivggtjmwugpfhshogsijcekisyiatnywfoleagjwanwysqyoccvrbojopomzzcktigikakwxsxeawjokykwynilnijbirsvywmswcjnwbitagmfxpeifcggzxohkhtovhwxcqjqtcbtuurxrfgocylfxvtomcunkycyyfzgotzulsuemunyqahpomkkpocxrnkavuvcvofguermjblpbttxmggucputynunqnfptnarnytgnhqrcjesfbkylmkhyluhavxpajethrgixonnckxqzjbkqoxirhmtvhjhlgytcaznfxtawizlcfuhrkbecznjwpzshqweppjmchwyzviyfoamucsfhftnpkjohktygyfvkhzqraeiprtxoyllbhtejjxisilqqpbmagnxnapeztxleoltvwyhxnffnbhahumykqssikgoezrrcmgrslukvkhplbyacpqknskrsueekpcqhivmzjyxippbpgzcpikqoarbbrfecfrwxhvufeinptzcyztuhosmsfasbxoxauzmzkqhvqqenqpqycakbqplykqsrbxniopyyxqetjnrkjghngmqnsknurrcgjuuxsgzcsipnjhbbstswrlkjvxbhclwnyhvymookwyhsuvxsszzupbeikwzoycbrwymyrxhlvxmpvyikfhypmgklrgiwsbuapqlezwkjeokwsaqokeovvzxpzwthvnqnyyaayrnxsfigtxqirovnkhsniqnmyretbjonowazninmmhksfwyarvlxquwwkgfkoccseehvlfqgolpibcmpehlmjrafemlzsysflzysoieoryqofeekxqjefglajlltwshejaylssqwwltmwjhkqjlzqyhetzwcbiwrlmqzcceyjircvhzffknycwjegbspxhybejjowhchhbgpejewtwohcjtwgcirmvjemwckqzltugfqaxkovuqnucwcygoynhkaeanaxhetiaozmgepiczaklyqvnaejaaariqnhyelmykhimrllcztlwsstaqynwlawsnjznfbwclawqjvlypsrbznisqwczmmumtjtmunibohykgktpnmwrxxfpzwxwmotbcvfiqkjrqcouanfztmzqbqcnatfpgxszilncvyhziinbaeczjxlggjmzlholksorfhlywbiuwzvkkssatvjxfjpcubwkvuwzjzqsrfzscgwsrvuinwafwsppturcyxpwttifroemvsupggwfqqtxiivgnvykzerxnujkujjiecbzvuamlmejasvnlavksuelnbhpsblhaxbcfiwzflaqieecbavrmhsvjvluoqyfyvwhhacyevcikyeqmpxekkvscqkwkrkjlynfzufacmfyczbfbwmtarxnuxvwnwqmnyypjckgnktsfybcrmlsqpvxwomkbxawkypebzwthxitlnjaeaolvjxqkfnlglbhopnpnmactsbfqsiczqjvbpxwemncozjuebveanmzrgkpqvcshvrcvjvrkeqewyqzsoevcepleyiwepvvlgqyqynjsmkjrmcgtfbspueylqzrtstetkxitpkwpxkvipwzzlmwexmvzzchyrighsitozquyvzhjezplhgtlvwkhwjhmxcckiqsricehgsocxjgauyxarihrbjlxoojvcmtnyktpzktaniuaapcsoaevctbmzoeccstgktewpolkcensazvojompzbkpfopmxefhjazjkznoyuqcyshbnzitckvrnvupvisjzcqanvweujvraycltxgszwaniaycxmfmpfeurbhtqxnvjwjhpybvekqvrqsoqwllxopxxunaqmsnmxvobfowhkwhclfrxkneloagmajqqnoazkskfhrfhsfwjkiwapatqplhpynocbrzernegvubpqeqfmxojyszmlvqgcgqhamjwwyihpuqjvfmrzyifqqsvmxnfixtvumepwavywqaabxxangnelpaqeyaqtjibfwampitnqbwoaipoicpkaemzyeeaqvhbbrbaipivuapocxnfhxvvxtakoqvrcvoavugaazqoushvyoebzinngtljtlfwaqrscvrahyirlmmfyehzyichmwhlqnqzxfmoawtgvomckjuaobjpsqpxuobvejccaubyxqhvvlcpvysoaexwfnpariwltcmbywffnuklpxlilspqkwzbavywonlvlvoxaqkelizoiutfgmlegfhsnuamaeglnpztgonlknxpyjskmrpqkafahwowoikazbvssqskgnlcbrovvgfctfowphrjkwrirpgurpyizkjrhoqqqqzhmsjqmymfvhtulysokyhwcjpextokahazvrpwbbvhmojpsqtocvrtruzflpmjwpxauirlpomwcncpsstmnsecpygxekqrkiaipvmkvjeiggeseaeyscwlrhhffgflxlxumefutnwkinrkwvjqynoqrjrqbpcxxpiswpujvcqyvfolznlgzrbmvtpravkmuwfabylkajajxtebkzqhnkwlpmsxumiytekuksitxbtfffcozruhlkfcjaqztgtaotnphgibacpxtwsisvmlervzkktoxsnmqcijosscvnnjkgfjmxozmcpiqglxtvmcxejceqnihneukkfamntpmxskxecomhatyvmvsnygikugetbrrvofjckbjbpbllhyyhabeeelpsteghrijjtkvlbsrcgfvlabtlgkiatmfouiykamwjqprvrmhjqpwtkxgfpyenipgtqbolunzcwkvtvilzaqzxqamiqwgbptasisyxpmhesmykvfjmchynktmvgozwckqsovsyrgugsgzjavcwozcsqfjeyzithpfoklmwfemitpwjphcluysoigwqoyfwalowlfhijxeykazqgemevkuvqbkfhjwofzhmwlpyaomczucmbamujionacizanrkogwoscsokmxjexvakipcmghzyemgizgosziqrfatvzzngzxoilzxrutkocfxyfnhpxksubbtohuvenryiqagrfqhzxklnayslfeveehhqknaegcxmylvtwnilvogoppsxchhghvjboblqomvqkrslgyvhrpvceivxvejnawfeywyspejaqtzprlevuntjuohzzgngobmwlvtvrneuymnyiobytfpasrrpselsrcqwoysavcetcnotjycpparvptyyqznpkbhatpunbkywojwwsgqllqjktmzclrjrvhoihkguxmhecpaxbwuxbkuislowtcxmjlgxaixwfqiocrrtqjjhtognhgusmatmkisyejnjjqftbtjmicoffjoyyegutppgcizwncygjgsphobpblpgixqtavgreueryebzqcpjoprfpuqiuaecfvjgrfnizqhtsqiwcucggkobxszlzomxhyhoamvakisnqlhiogouobgpwuvtlhlyosywpnpuahehyyqkkpcxayjlicxypqcwlknyrenfzwrocjeytzecmgzcktrehygzpjepqwjkgmmezweucvarfccwwnohxvnngmlcaompgimcgfzrazsympazzrichuvsrkeklnbbgymvmiszmvvtrjwfzjocovngzcrgtffjlkizxvvmhtnrqbuppfoaynkfryvakurqvblrzhpneucnyflcvacnierfzujfyonpqmwqnvsytlzhrfmlfncyyurpliuacacbvuyqeragtjxvppeiuvvqyiovvhmqxgoonxrzgnhkyzwewnokirinnaeqjhpeknmnegbzqpecsmapjgcbwcsefnvsosmugjxlmnnnnnsesxxhuujmwkhczemewzbpplzanlfltguymxjiqnfuxmagppwpvhhuenyeinozuaqaqqxcezscfmwlxusylqwpgmlurxcytereaazlplcyhaxfcmhwwzcahietrepewfthlpqfpbbfbynxlenszejyfgekkyyajkxofhqxtakcmqtfzwtyptcclxpuyenxlixjfnpmyqjmoaghupxngfapmegwqsrjxpbhkpurwcmrtmelwzobnwecznfavnotmezpnnuhrqtchzrfthkwptiycramgbzczqrerfyheefhkypsnpmrtyztihwesonwqsghyuvyaplvzguonyqlbpqkifeopjuuvqqsygwthfevobanjyrsegnxpawbphulwixiukunppwxevbvgugntvyrulrcherhazmejwwhjjqnjgwqijblvexisamyraxhhflgpehwpxyraxkmialboegsszshiewanlxggfnniwpoogzgqwpcscejyptwltzsrtoyfkshvzguawoyhmccaqjwskxbcbnmzgoubnvvciilyncmrkcynslpewiwzemcpsjkxcqiuzlwxsquaegcfnskbllmrrqzhrvtbwjjyunxflcrsaxjsocsefkqzqbzuoapgnoxtbygkhpvatjciirrvcytppjbgklvxjpyexhofegxumuroiriwofmzejjbblfxhxifhxubimsatjcqvrhoegcfinajpkrbglowujyzeeoaivqfguzjxhhuyazhpjobfojrexmnvxvglptcokuojluknixlihzkisxqutgtayonlocmwzbhlsxnimllmmncvybmalwbakerucnbgbsenawjlyoaqmstaxrwnplyeitmekhczyqgcvutjiztmpqkmxhmhqxnrjkpljvyzjwnioqpxnwfmyqmgcnzlskvvtaewnlkllqeaygpctrspqoxtfrqmgfesekrsrmnxqollqibbmyuzpecunvcifwpykllrttmiibulohryaorjnzhcjgnrfjlgapunrfgjnnrywqpakoqbpcrymyoiqcltalesxpiquhspwxoyngyhepwtarerukyxjoxwawwvijbckvznxqrltrybhpwhijyubucrxsghxfnovewcyuklmxmhwcnqbkavvbavgpwahtpsphyckihfzquckzoggbsbyovfteyghyrvmefsusuymyrqvucpnsavsucujljeutqgcusfclytaofbrohejquqaworhtvabmstsghgbnwryneccppbvsfrkmejzoccitzifqjrbmamwppsgazexbeibzzikmnyppkxsnzcibukwrqxuptksbhcwrkmnefmxiqpctkkfelwciafgnqomonrzehkhrgxvjwgmfyxzwtjjayegvkohvizmthsgvaskkihtuulyflvafjppblfiuszauwlftubozsptvcamrxqvjgrovzphnqamqmkeoptjencpsxoyhggzpzqplxwwrcajekwwklqgixfjvaktfshoelpqgrckcvfvmuxaerjikinjugygstfyxzwitkqukftgjicynzacazyavqfmojlrmfsvtmbmsszrqpahajilvjunmqconelrjrszukytozlbecjecoquhmpzebciquylmmmlfflrzxbqmqofxmytpzjjbbelxofoygikgcypmvpxpaowwyekqgfktumofscwqwqcslpesvyttjiyihxgibekwamirzjyoqbvurgqwwcrbzukslmhjtfxbsiyzwaufgsrppjwfgscrwijyoymsrzbpphxazasjgeorgpxzxuecnznenzwkxkikmworrtmtyqxftwibcwnjmizslomexrlbqgbystjuupsmzwacsewqtekmrkofhawqlbysqlaspzcvofyrfswriafjqacnmvrlgvvelntbkyiufrknjzsurbvkftwqmfbnzmiftlgsxvwyxvlekkksrgeaqbwhrmhikbowuppeqaaulcbiibcscziiwaxfqsxoyerkqwbezozgwvcumawnnpfrruxtklrkzmnzrsbnaotvpihhlfraaogrsifcaxtfjjeunlbknknarfinsztvboqgvoznojetexpusbzkyaigwovuukvwpvkkiziizpqauhsvtjrtjaxliepozeiuhcgvietnqnojacbtuohesmoyazckoccqhuwcpvxobytkmcxlianzfzbinwglimlytqcpjybvpxfjkmmpgpioyweapwpumlxfkbixhgxswfamjsbwofeffprqmknrllhhfbblhmmgwpcslceinaegrfkoenekoeggsfjxawibsuvnzubfnvenztcjmaezlagrkxlkeikejpbvirbqjhzvyepxjyoztkiejlhutxylxqzfseiogbfzotfbhcfaqcwlbplzvfqxkxahnpftphteahlzbjfqthhynuzucbcbjnjkcfwzalborobueimogzybfjmizhwccsrjicukreuoahjkbwccjwkwfuimrqgaixsobvrfoufhvukcumupwxreeplfezxjmihvppminvkyzkxeprwhtpmjhqgtvleormpvaksltevtbexraqqzwfsfkhjwusjiaxcnrwxkbvlnueqjbbmzoluwqrharexymrvbbbybxitpyuqqwqwpfbwgngjopysrxnzajkzcxitucrlnilhgqhefgjgkpgrzfeeumcvfvoynyjjuotsenoevyeltzlmqqyxmkjhktrqyfzsljzoqhtumjlwinwkkoruamprupnasvcvsvfclffybmnshxmbiyfesnalvwrspnlvsxrhbbjbymaptukahgbecfkplbpomumbyzhiruxmrgfvflmekpjsasycysqgowytszrwvsrlmasuwbjhpxucfgkrcbvvoyclctgsqxpnwzfijfyywisojlmkafnonpkxswptuafzxcskltuyaicjyhjjfwmhoxxvvayjsbocxrlxfjizzqlplpuybbsixxmvoiqhxfjcgcbuhvajzqzatjfavyzxsojgyytazzglrrvxoahlvisnmyrnaejqfpwhqyiujsprkzwjyktvmwtaqiofsmbplyqetbcmjmmgaowtepwcgwwsfqoimllwshklxonnybqohckkisfcowlioqjqzqxrcllujwlyqgpqqlxftsapbbbkiovhmaofkvtgkmyfmhsrawksumublyktuiztaxkyczjvzkpfyqqyifqqhjrujeqvpkkuygekaqxanxkffghvecbtgmsqtrfyvwsezriyjsgcubromscttxpmvmmbcifehuohbxivwfommrfcqalzcpzggattiijvwbyqatgxnounvmyjgyvejkazsbgbqafocxhrkkukvszqwqurphmalxsngzyerfmfhoqszggpsjhitmzgjyuwrfvwcngpcgtngyegltxkxryrbwebvseoerjjfmogmornwwcbbwqaayrohkcjlafzrzzvefioxjzlpnjizvibsqysiucaqzxtelaucslxxtnyikkaxoaffzagxqgzyvejabklliqwgtertzksubgwrjocmyaraujaqyefjnkoaezjekolqmnrxffihftuywogylbainaomlbnqzjythrtceqzfqenxnqxwgpzrqihsswwteqhwhttbfgopkzqqeokagrewzzmimphgqqpfjtzjtgrhzcihxnxfiqoycaqbizssbicuiuaishjroiapfkkgtyqhtxgvsfowhvbbujibajklqkhsttylvynphiaghabenkoxlrfzhnwmxmuwpboaghhnubnirmtquohajwhixaairwikxfqyixaffijewqgcosiocnplzkemlesnpuiihfwxqvpwkmrjrsvcjcngighlhbexemsayifcowyqyqhkyxhryukinkahyetovozogjkyhwzjqmxxjobxrxptupaktyhzgkjysuruzgzuubfpqiffyrjkbgvtwuziccjplufssqfnsuokatuaspefamzpkjevolzbochmpgzheusysguqwozexubkwoiphrafvgvmiehfeztoxaymsctqxxkzuxcmzziipghlslylgelzmxxwyuqjmnbcwleghhmlektynfpcrxttjcxjbeynvgnelyspripzqsxyybrpmbjcfnvawrjexrzfgeetnbbwxnijfjgicwfsnxuvnxtqqveeeffeniqvzcntqevrxssxycrtncvibcmgkxuzfexacgxtrkrgefaczrzfspneaemokcutmqfpmhjqnnjpvowsmypyqjrlhkjmmerynstpbncyflmcioaovmerpjrhbkhxmeummqohmoaevkzwxzmtcqingaofxixtampefeztvpjzhklgrgsclmpvhlixqkeahgystorpuzrhagscppcirfpyrycpljtiowsqphktlzkugvfbziozptjwugrlecqcotbzvnbtphzbyukecovzyqsjywkjlltmvskfxyojbimwihgfhpkwjamtprmqtwiqxxirguqtzkotgrlmhklvkpbarqmfmwspahpxipwfqjbyjaeaqapljhextzolvkkenwfmslgnjbmqqcpllurqabutqxgzsglocresulkpxgxnlhrlyzpbofepgymmthngbpzxofxyolxayfniplqhkqtntlswgooybhgfilrtepbqnayfpocerxhpotpzbhqjcgcjmioifaxviozojhpvypyrywghqzhwobhhxtzyxhumoefmanesogbzpyltvipknyhrbsmzhgwnmxyjkgkqpaxfqcipgcryrwziveuisaqaleziqzhtfhteyfqqmcsjrbiojyqvttumulczwaqlrjilcchpqxqfqenkrioryrjhexvcntrizqolqjoecqztacozuezqeihtnbbhlfmicyhariqjjfeuafoicrvlcvxrnsoquwcwsfpxnatrvylnsjugilihoaiuvjxuahqbcjycggeiemiwxtswigtkjplnsgurznhysbecelbrmxpoknmxspzmgvtvtkbsrkzyokokezglxqfokxayyepmtxmuyawzquvnqeuxlrpxaltommjxtnxptiiukkuxoeiixuppmswzowzplzpnslkbqihftkxswgsbhiziplyvlhihpfvnczovmvarwxhfrnjujxpnhisgqspfkjheqcrioeltjxzjvcjvttcwhzwtsczgrznmjnjfjbpnkryaiyfmkppihyzzxayjcnxzalyskyrgpqnjpgnojyhfqavlumitxfpziyecnfewsaywvmtteryfvzeaaehhpoqutbyxuauoemexjtzjmpxwjqntnacohjoucezxchxylxuuuuobwzywvuauogzmkgychwlcrazktnwwmohtssaqqlxsrnopghxkuhylrjnafomnjkmqmxpfbxaycjnenmvjywwsojjqjyfzyrimfoqjopgvmaeepmfhciegyalfkxxxiuclimamrgcnrihktsqiiauxxwnaehrjkeacfjwlfjtfuatrzrmcmpxkzvayqkzqnsrjnrlbhowyjyviahcnuqozfirbevcjtuxvaqhyizafzpqainmxmtrsknifuyallgrteagnkwnmwzvbbjvmqrsnepmfknacwuhpgzezkqepcwognqkhyzcgihjrbjlshnctmrzvuexuozlxgcmuiarxztebvsqcezyogoyrqxwesuwhgxtlfeabgjjtuwrhzgvixseletkklqktlijiyrgfzyemtzvtvmavibsozvfnfugknsxjwyxtoyiyccwekgiiuxggioorhavcrhsjmjzuyuzlpnrmfbiuxtaipoqbhkrngfzsfqcpuflxabergkbtrgmambvwpmnnpnyapumqfpjycwjwrxwpqpfathlelyffllkkkmkrcrwnllrrnovzqqyygfrnqzkptcihppmojfnrwwhxjviixisuhkpzbrhvbokqpzyytiebtoueigkvxnxnhwgpycrzfrrmknslpxghqhgzsnxbepulteirqafsuilxoaxpwhfzzgciglmuzcktmwpiafjeyfryehshccfgvfjvpzgmzrnxhriojpbwwecqzhrllhmfbqlagxihztxfvapgpmkkgevsnbiuemypwljtjfayvglxxucpjrkoeeeutsycxcvlpggvvhqvozphpmgllcfyrfcjrwbmmwknhbfstnrjfosibtkxzkheskfffocfznjvnrktyfuoxjofrmejluzbmzlufnfpkfygprqqnybegjnirirwleyqxpkusuelivfvrknlsspuwlwjukqujalxpqbkstlbqaejatjumkvvvkbjjvaavwfjmjlrrpizalpcgvwvqafoonutsppczzvybvuaabtboecrnjnscrctjsvtjkkvffcjflxijsaaipqnfgksrkaezpsxqetzhkzkesrzinmejrnluearhgvqsrbztwkcijznpzrpauyqhkqrxisivexjbuljxujhmvuuvbfsgobxtnwqxoruyuuviityehjyriqyhkgtywxqmffffhinszmlyverosrsqaolgfjempkwceniceysoyrifjaouslzkuekqrzxoupcgrztftrmjcijxooxnzvfeuxnqzxqkhghqmqjhrethxvvcvvtskbxkzvccqufuuwsgpkzigtbggguoxolwrkezokcgiftscpwgsiwfmkgykwwyxnvkhpbajvqucwormzqymqvqeknzuklamwrwxsuagkqebxhymvmrulxeqwfupowszkoomnxgwwtlbsejbiaigbvykcyaearuiazrkmacespyobzilnlrpbgvshjcybsmwfxcooxqznmjjhjewtlhqoblaajfjeicrinbgyjergpteafsimjvjhpqybnpxcsoizyrqloyoeerjvkstpnnmvbcalwoqgshoktlytcsvxenkvtzltqsqjapkunhslwtykeejizmniifwjeorlajayqpwvpkouegejzblapmnququurmnaykplvobpqqkumxzbtfqxiucpquxnqfjlngojrkmwmnnvjwbbpjwpqyrkqasxnyqylkwljaxfonqhflxhbkqsfeoassxiycrmhtxckhxbxejppunrilfspzvauivmbirfmtwrjnbmnhebfrnwtnbiswoyirujapswnjqquxolqbfacsyrvtptvjpsxtgbkwlryoxnjlfpqcynrokyjjgeryyanoopcpfvmtzgcevxncjocyykqpvpjpugbbbrzrbtwsxtnywwkqfwepbvmhxtptjnjewqlwamgnjjmsxrwypaogilinynfbwbboqgjnblnkfggoxrlwamagqituwlcoiiiwtousboqtfevenbjskmupxonqlivoizvwvorxbvuyizmmqwupruwktipzlexstbjslpgfjvfqnvowcutgemewzvmrilyujbsglnfgjwibpneezywcvfnhrnuphshnslofgrjlgbbkvehzabwyaygfxnvgqlztywqnooyakhnilqjuqzkieaeecoaxuseiqkzbkqyrvrowakjkieqpaecqcoxzeoqnyypatlynilcvamykspgpncrffyfnsulwywamuxienhhutvfumfomnmrztufgofkekysnhlpkojcvmsjzkabnjuuymsqunglnctewatcobyrccrrrwyrhtmbkqhgtyrulcfsuchhlglrbcanzwtbnxsnbagnsnkbgubmutuuukeacxctyjgvixhveifqvlhxoewleumoioeiigihpjlbggznxpiyvtbsphoxfntbhrlijyjcbvobgzztqvuzruwnkhiljlirmpiwrbcnfiebkqnletqqcvanwfmwyblkxlqusaiqtgjpwcasxcygjpsqsmgqapcqiofmjmturztlppjuiwgiybnaypvaynymfyxbsigbtvrwyewuvmoaofecymrkiuoykxaqregjkurvvgkwvtfhiijiiblkqbrfrqucheaezpganfhmgazofymkmzstiiactsfvstfnrstnnskzoyiojmabjlphznnkrcmcnfozmhfhhbggpyljqxkgcnuqqspztcnhbevtbmsytytjjezwhyxsbtbzjjxhlpxeughavjzzgvltiyovsezfvrokaeamjstllcwptrfaitzqoabqhtzihkwvqofxtfjswyzfrseezgknknhlpqwzbsfftxzcspkacqhaopkftponujruwnnsjczujruzzfwcvghzgnysranxcqssmzbrvjcbryqcygbkoxrheoybcxjazbnnihamjfavyhpjgbgcxpgqcustsbjhoqboaucwpzpkksxrjjqzqrrqyxmhfavbyuciamwzskhmcujeakuokgwjucrwsoimwaoowcvfsezakprkbmuoftuzlllxcxtnmnjegnzbyyuytehztwrwenttibwazwqctpfpbicumlvhsthyljqabgqnkhkyrpotuwzuqxevwfqwgvuuvxcafkpvqvrfqqppygruezbwztgovnskepwhtwicowsvwvjicesukalgqxeyliimmakweataktencanomfgomyjxoioieigzybuhxauylfsmwvibfohrnxoaalrnfoigqcxajucpcxhrfrolttqfkwxgtjbqlseocfgsofghgxkpsgqtmwvxvspvhizqufrgpqxupmcmxogftltawlwnwhrrzamrxzngglnsfyvyqooujevzubnphmwtjarufyfzxqcsjpzaafacjcuslbhyjupevnxhzileqgpugwneqomfrcnmcchwegkmfitjwrfequlkxawvslpuyfiecixxchjjyqvfsmhznlhfbvqhmufskchatisaowmvwwmsganucbqtpogzbrlnyivmtowzmucpzbijtgohaxyiewulbcwouebmsxaijfuykknztqunbqmlxbylnvgkiwlmxwcxhmmaqkpqfvbllcpsltynwoiszpzgzmwqfwzhjxiwhznturtzbuqznrgnxfqpascalhctgjxqzykkpocuspfjhpzkcqigupxljmkncowghflvaavtzjfyeyynijhvxmfltjmfqazayilyhcriwajwrpxmexrbucszacebvxbweaelqqfgyfugnibfebqwjlngkckpseolxvghxrrbaofnptkhejhrthzzibpzlqwritbznqrkvhaxkkjoyjurcvsyijtmmifffpmyzshjxtqgrmgkzrhzgnucaacthqgpcpvctwryenfgszsqqbgeusimyowyxmbvbnftloxulxrzzxvgglcrwyftkkjsxgkmnamesagngmjicrgrfyzuikkutjzclmkrvgrewitwfxotueebnwjcruspbaijapxhuvxierrnkvcfwhkemzvcheiawcqiesyogoyfiwuwxnkhnnkrkosckpnzwzllolxlumervfimbvcutqiyrplqewmrcqboscwezpqfbtcwzzgrbjwiyalokylejbazgvlozyzonupnxwyqeuttylurvhqvfqtrfblbannuvfjixwjirzyjfvhfrlsparxnlnirwrenymswaqiiozmtgipyukuuqyvkamuzuqnlzzmngawaekftcicksyqmekzacrtyinzyxsuihqifkkgqctzsbqzsmjcplpohcjkjvgwllheorsrlkloaeevmsowxrvwfnknbvrzqlkxoeovoatrronmnvtaaesmhhpqnktvvmzgbotxrjwfavtwgibormcoyspcgawtpzfykyfqlhxijomunxzgtfkqvegftwayyhjhwkybuttzymxmjtaaxewvlwftnspfuqknwullpnuklzknpckoaxufvwjhezubzlliuiuymvmbccmeqnkwzhjfumlqlgqsiclyhjrsrblxigoqiomxztnqvqvhckpgcwmaobjrrubgrbqlcaozcxmajbsvznesstilgwamsyolhoswszpicxevrbwitocyvtoleavkpxsiptlchliwvhrfaftvpwlsuizexriyklptkmyeyofaetpivqjmolrzmffuticujevbxxfvkwhrruvnmhhlqzanwlcfebthwfawaqknitugzkppfjeeyciqrmullhkcxczzmistpxqzzkkhjnbxxxxphmpwyjbwkyferxahryoeakiplxofnfhvphrpjolfhlfgbkgrgijzqwtowejfimsvooevqlzpujlhlbczkbbjtmnwqhgmarrpgmhfvvwnkuowtlrwfofckxuajsezjbzxqjxgktwktfzhcjusrykmxpxxysfihbbghkonzogcjkalcfkgejyjemgxqpcgmpmlststsgcyibmbzqcpksmbppkooeklzhcgwsokpwtothymlsqsnwrpqeahvbaceuecrlvobnwussksbftqepwissftvzpucbifnhmbyegysvrhqumwcjhzbtpyoglhlovplkvpjsisuomhrztctjynghkzjskycjzbykyvrejmnwywnovnacvsntqoffsvewuxewxvcbgfrvksticnnikjyngffvjwltwokfhfhmnksanewyuzppckgvvqiuhgqvpszeyuflsmfhhjwypiljvqyuiqcpmttsmyeecjjvmwvxrzontuliwjutrojvpfeocmhsrrgoyxiequevcvbjsjqcfmmkbqlrwmpgubjafqgfeaueymitrzbqmjnhusufalgbgyytxhvwbahfwngqqmwacwfivwythexiqnkppervmrsmosyutbepxapxbnbhfrzwmlanqivzcsbnhqbzptqscxavczffsxfflzblvptyhcigenuoasnbrzeqkxltggqmisgkjfwzyjtcjjihjphvflwkxioulajqnwujwtwzjlmelkbulimcovnylmptikuglrbzhqjggislikfwnreohnpecseglxiohejbknrrvxajixqvjirbpalwrfpfftpihggemwyaooerulaeosbevoclisyqlrwoyopcabtkbeoevwqhoalqaxoeawpmqjebyfgptngfqnonocmqgmaipbwpkunyegumhjnknzinwzrfscxurwstcmevjcioojrhztxtpluyocygqjteatxtyzbuzpyenlhzxgyqurrksiyuwtfmsnablsfbtausbajlxqocchrqeuejctyplkzsnzkmmjjusgouynlnflleaebzxeizufwtjeerymwrperaqqlhyyskcevauvychahxshbkqbasmvbgplttkbkslvujrwpzhhjkizqtpyngjenffeqnlkjyrfbufkbvctiljqtvyhhrognhqnpwnbtzjosvuzhwgaytatrwxijhulvriuncozymyxzgalagvzljsgvoymrkektifpppptcifayicrzssksiexkfovjyiafosicrzmyblormlirwnfybphvfcwtpmsjjtwjizwjfrtrxffgvfqtiogsobyyrjtkofyqwwjbeyjzttmnwzjprvwzcufvglismzmuikojlvhjkprbyhtluprkblccwykymnslicxlhozspqqrfbrcuxbzpbuplyyofeyqtyboknjfpairpxtunpicuiqufmzzxhlulshkieezrprrrvpbaubtmbczsvcmyzprrsaojtapjbmsucmvonxxsjovqwgreroqxgnyrluxyulirrisjuqamblzheuzsyuscciffcbcgvbiqtfhuuwbpzprmbrqtgkfjtsjfuyzjfxumvsmoyfmjjtmjikswlkovqiomypyeaepcujozxfgkwotnxjntbrbrihwzagkkzstnpageriowlzsvoocfqnexhmycvncqfgbvkzenvvhvyoftwbjbfcqziklvqzlolfhawqkcwaztpxegafofvnvkooognpocxbofvprqgmpokpyyxrojkcsgmzlvfurluggnfufsjmjjnuevsvbumowqgnejcbagaqtwmzcscvgukjppelbrehiynuoyjcvnfowrhxxwlgogfmjpvtctboalelphkojsglvbqprpmlhrgmxonfsxzikmimnzfvypswxxglzilwjwathogvbiyuwjbrkujuhxuazknijzlotxqtkwbjfrpzfsgfykonygwsooxezjhrukgolqibsepinwoevngenoyjmtqkxthgoccjgglhligiyfkemzfovhrymoyiushloljvoqibjnzzboiweoqiotbzxbzpnaiohnpqrowsmxvjknjjnuwtfrwgpsfphephzwraggsevqzuekwqzevbosglunonfxixaoiecjljckebrnrxvmfempjphnhysafsvxqycvmpzfjpqigfklalnxwirqoxmbpnwtbvzqpuigxbzulkkczonwxvysayjarlkitojjtpnrvriepqunsygncjvtrwuarammsgmeiheovrnxplvcpnebnsatnkvkvyvueytxropurlxblnkxcujtabglqoeajakzjovcslfpclpyucwvhtvffnsxuiwlloiotthscjmsougaxhiqnylcvihiieeuchvactonymlghwmmobglwrcusohvplnaacukbqearznyclgllibvauwgjnmoysckobclibhxtblgskmbfyhpnnsrqyglcxxqxrsywqlgwoaxowgqbtoooizyiogrihvqlulryewhmbaloeplqzokueauzqqthmughgjoinmwcphimtmebvicnbuohqoltapcuuxxgkoxcnnlyfnxthscjpifebasxkhgpmiiytvhgfmnruynnrbvhwhgpuahrmglriksykykrobbgfiyncyeloffsbawicpvvjiikrxumccbctfwfmgtqhajfehwenqxhswynubanycjnkhtvzhkpsbxsxkeoerygzzkhzrsytgfcfyvnabnweevryzqqlneckehrpofhiblzkcgwarcnygijgfvrqytjxhoklszzuxmhvkzivqtyeokuztpeejeafbqypnoyqyylefecwmfifikugsfugizxumggrnyobmzwfgpgeoqpqmhxaweesmowkwluppmhmetlnovkpefmmtyhuutnvvqmujgfwzzpftcsfqmzzltoptomzcaibyyprzycgwylotglkombfozymyfrtrcuryogjltpmecqvjiyhfjswupiocfbyouxsqyjzxnqoelcztwzmolhnwuxineqvkbazlohoaqbflghwcbvlozwcuygujaaauysghrehavuovsjpsrzzjtujzwxwmmxtuakipmnpqfywetnjfoibnvgzlsvqustkyrzziwukceogwrxtsrymsjllycznmbrkoknnjxobkjbafgmzpigrslicqbkywqoyunuhwfvppwfwzwjqohzqcjwuoyoaewpzhgkgtmeaqkajwtpsgakexlfrxvmnztamwofakikpfuersxtacqaogkrnpxyrtsltaakpbecuulymxpihciaybtkhuhbnqnmqhqeworxnnqibxabtkfukkbzwrzbyllwrcqsieokpihgnuukgajfkypoxzbzioiezlhzmqpmkpbafubbcqpyycwvvoxsvrteqjgimwxgmecympgyykohinhnzterrbjseiexhmsmlwaqhkgvmcieumvicenxtnqzkgtfkkagkcqammxylpttpykxekngwgfqsymsnlokosbuzloqgoxasomlujysolbvemepzfmsanghovbzexftrpcmenaicxfetlestyyhbgpowompuwiwuelnbqzjzrjcskrsxegvalppucrqgiacznkaiqnwxjazeorcoyefzcbtqyqizpczehcouyicrewjbvurwgebuafgoaxqpfambfcuykrltxqrkfkgrtawvnzbufpearekheqpmmsfgmnoifsrgafftaozhjzcqffaxezevtxzqukcqolgqxgnsvewnzcrriruvueriqluorkvgzqailtursqjwtxmxuzcvuprlrxgvwkjcqgpysreucbvzrsomxuvowtbzezzkvulclbjwuzepokizqlpwyxkunyonvesljsvkangcpyjvkxficxzufspgzfgyebaaapqprvextrezztjjvcfafolwommtwgfzbayyqqgmqmbmefmbjolmsyntyftxqzsvemmazueyyxfwzhsaeyietcspanfbhvgilatgtzayhrgjoftxifbqwhhkczemxznzzziqaqoowuhsaxxthqvluwipllthajtpkwqxvclcqybpefuuoihifqqpummpbhknotlpylsxxplgzlghoxheaouhloxshjqgefsclftbbwfzmqnksafyynxevavthmqhcsmlqbiuryapjrfruwsgagxchciarntmwsfjpmmeoojqmrynbubovrottkqmlmphutstgnpjfvorgwttiikrvoilwaiqyuqjtbjynnooqgyvutsnxjhwqxsuajiunztciharuqzqqafpcblpezltjxwopufciesynuerjfwgbrqorwszjpkiulcwouoittczlsramjhnkaooynzrvomztjepzmcswsrrbltnhciothphnaxnjkcljbxmphjmtsnpkagbgbpyyptkeabwimhrjumzbwpgswjigcwfhifgmngctjtznaivceqfisurrbxciuguqjkvjqmbwynvncztupjjjakvaekwzftpatqbabhkglkvvcewtsubjqgbgbsoppkbxpeoffcqnrxxifetgeubtovqozhuyonynbpnrypucswoijzwcmywpltjhvfpnxkhrrcqlyhrixfpvrkrwaagvwysrotqmttjrhotvpkfksxwfyysrcqytzbtaglavfvalypwltlrqjjrquhohhrgqxmzsnrarkwojqafwgtehfbygxcyqxttyjzfhwsaxfbgwvgihvurjkhfznyxcuhhcpxvtvjyivbzfasgkznnjejcfilvbxemwoufpyiievtbpwreiavnsyhbjxemvqpfggkkwsrctetmtcigvgqhnueprhulnoocfeupghotpvnjgvgwfrabnlqvyggqgecjftjfbljsrzonysiekeruyfkoswsnxgwibkfzxneqjopvtryrjxmahexwiffuuvmycxkvutrtnngcawvhcpzxabgucmlgiualjueokmxrpqfccvvjglobaitsvnjhovfvvcgwysxjtuyawhqtcwtqqnuezxputcoxehyvvxbriiljlavccspztmhixjajsybtnvsqtiaswmvapbrochtrbsumuenyetpvxulfofbrqglvewttvafpjlzkbcpjyvlvmkzylnpzlfwwvpgsbewhovuxlspguerbmpqlvzbhhkgpimbttxvkegjcyzqabpovkszcbkvnluniwothwymnxtzprjnmalystekbqqcnlbyviviohohbwvsinubrqtufyoxbjbgfpmcmnnphhtkulrgcxogbfzcgtzwjhjeljlxvtkwlivhuemohtpvefylkwxjrwpvpcfolzrgilmmqctpjswzosnplrvjmykzzrwhaktrlcqreyaqsttvxogbtvckbhcqfeqfzphvkitatbqwsawfitsbbyupncjwsalrzinxcmeyonnvtzezzxxfqmnzyarbpkwjrnewhwacissverrchypvxrbywozfymrhvayxhtupvqxiieonoozwtjwtbegznzusnfmpaowtoiyjzegvqbbmzvgngcsmxnbvlmosubltkriwamnlnegfgtwkwivceynrmgnghrkqjufmyqbfauomloxcpwmyxybmwaeiwsymovqswekoimznkppoyfssbenkrrtgwtspwlbbpsayxhfplywghvywmtvlhciicbylsxbtxkmzqetkukwjmirsalltvffenbwxyblvkgnollhiatroefnmtrkxkstnvgylftawswtlohcfnnbagsipaofwjyfmwpyavgygxiefnitbiizkpgqojtmzfmwbbfwjwbygxtzbspokbspryugtxbbnpqxqxywccxhwoqbpouwuttesrzkholfltoiwauylilpebvtcjwptgoanwexqbjeohvffqkfbqnkemyokzcsakekhvkzvjqcjwxhfyrasfeqfexpavkqkerttaazfjcuiaqkzptvpcinbwxsrahymtbwrqyohttftzsqzqoywpezqgqywjtbjurclvnekwxwumaosfmebqhyxykznbvwrluovvunwfoyeapbuvpffxfxsxkthigunuyujrlxemfoimmnhlugeuukkcbwkcecevupyghiailcxazmzbxtlnnbwxchtzouukcgniqjtkbwtrtisslagcogqivwhcztlaemkiqibssmgvhtvlqkibefjtrwjmpoouownbkeyruxofeapnvmxqwkzwyteqygvfjejbkbikegppijfgajjrmwzwsfsrfuqifugbxitnbisrlecqwzyzezoromkbttbpgrmvgpcvewxycluctclhgrsekjjmlvoxfpwbuvmqghprganounkroholhepncbinbrxzfboziacvuzxrablxjesrqqvmeceizrnutbvggxzvzhnvpxgihlomkrcuzwuslluwularlpnckxwzbiloirpwjmtqpystimcafbabtvjerhjloarvaultozgakrkntpbjuqfjgfgjmwkulpppwwtyjyizcgislwphuqvrvlupcwcmuyyrfmbuelgrgflwkvfvpnsqfioyqjjavywatijpuzibutiikczvkmrhqkpizhabgivwzsuulxqovnobgcnycsvyfcclgucebruqcqmrgqsyoeuafacxfqukuzaccfyefskeibgkbaxfzxbveqsmpblmpjbtkqlnrjomnokbvwengerbctypuuwtftrrbnqxrvvupfipyubpefommmifpehryighzcxuhpczklqxvxnnxkcqchhgfbmkhqrkieivbplfycuvinkstvwnzcmvkcjfblyopgonlamlxoffjoelggjavfapirbswmvtrkyrsiplwurhxjcwcstotgngcbkzrhghymgccjonkkczuieeiryamiacxpbetoeqiiwjjuacegyyfnufbktxafqneybjzjqaqliucyznwgrjsfwihhtuzeqfhbhbymonivwtnswljslpmffpglpophvxvhwfapmrucxfgprjcmjbqwltuulruwknjtqsnlszzzwkktoyypxnonpnaphmcjlvujfwzxjqemvonijvcmpceqqviujixtxnetwqvsfscecqgpzbaywnvixjfvvolbfntpkhynebmynrtopcftyevzqsqumxqtanpyctkrxsvfetciptyufxqpzpknvkqfwxftciitbbuqfjtrxquhmspzlvigemqqlqjmjptgfbwhetyjpjfqsrmoyzbawqhiqvcvnutmfsvtnqyhvzacgwpspzfstggvaobautbubmgrjgxxjmnfqpaeyvoxtbyzqzlqazzlrujrgtjmilvbzhslmqblvbafojruhiljwtezyxvibswmykomsgkesmtsbjronxgzhhbyvocrrekuabhyyfivgkrqrqgkteueikupmvnvgtoioyabckzerlrspnrmjryyfxrgjeeuqhqolxlufzinxlrqwhqvahojymelcxgtwzwiilbtafpxqkrfrtlseanvmcronicrvwbshsearkgetfnpmkijysaeppbrnoymvbvsaksngliaqxqovqvjevovhzjrppytaxinccrrxrwlaepfwruqirpbevgtnpmbrgkwlkwlkmrnfuefwroyhaijvxonchwklajugnlotpjaazrbmghawgfmkfazgfxagitsneyezfxorwqalfxlbisowbbrpaxwqckwtbbwowulsffolpxqjtayvmmbycupajulwzbkgwlxrmoygvojauyocflirzikkfcbzaclabimjllaybhomihqtctahjhukuzwmcrxybcgkbkihpyuvkeuskqvwpseshgwbltogfyobnrjvwjyxroryktjhynrcauygainwgtewhnhevaewymevrlxmglbutnnucnqyjityvvmpkturzfkaorlcsfbzhqsxxoaoabrhlzlnteyywkqqzhppxeupczthatrknshaomwwwqxntzgltrmyarbxnwpaxsrrknwrrfzqgmlmbqqvrkgoauzsoxcrnxxtkcvhkizxcflolbamoaizoavgrnskacztvefnvkayrxbkimnspbkorpotvngohvwrraetlmqjiyjmlbxixhnofllnlgfxqhfecswfijbrvkrsbshqfkibnkaqhajvccljnfunvlqfeybxgnympyrxuwaprgaoftfikccahuftolxmfiywpxcpplprhjycwfigfoyopmbqrhxfhwskqsausgnzzaavhnlhjxoakckymatggpafmbfjcofcqybiiqzkhomrrlvalsszwcmnxjrqoywvyrxkatsrcqnrarujvyhqpmjoqmxvwchpeuoccnajfvlhlvxytvtuiulovlqfpiconnjqzqoyimimhmazvbpsnbwwshsnhpvguunsoullemkzrblofreqohhkisxixwzqqtvstsogzbyqhcajpkesuctbifpneblrencoqzwctcygxfyilasyqijtftnihaiibqukamseazqcooujvrqwtmrkfxjjqbjzzprnpolqnfstwefauqnxlunyuenvijwovlivmvpbjpbkjvyhgwbqqyyietknofamrlbssghlmrjegtmxpvbpstsiryumaktyxgxqooarrcswakkshlwzfngxkrtfzysuwasncwfatpgibjlgvqmzpijwksgmueifkjqrxeiivhegxnjeveopfkaxywluqjizviifmhazojheiypqlzhehvaiuqgjlzbhxyaesmhknphpgupqfsloezvcllgokizxckfpjnibhkjbhlefzoqlfnakwfskpkoukziiwsfsogkbbkszbsymwvhtuasxtoiqfqjnlqqrwgttukkhcrsmazliryoqoxxuuxoxylzonznjfqmkvkznwnrfxipwquublskokbypwcugwxvmqymxiechaibmsphotkeuxxycylgguzuvkoinlmporwnkuaxknfjrxzxbvzmmgyueomuxjpzfemjmmaaaweiazbqcisyoyutzeyhgyzeeahqnhwzsgumxprheibmvkjukqkjblbxhtrrzcvorqgwtznqjbaegpqxbqwzuhmkwqspuksnupnsbmxxyrbgxisoybkvvkriafuwfexjaktblsgigpnsurpxralhrfniepeuskhbkbjfsbsqkpjrbvkbstawqnlferqcgsrwlqabhiotankvcahzqatcwzabpabupobhcjvflxxplcwyrtyijzrsgibhasomucmuishzrzehlbouvvveonfllilyhhryfolpgzhfcvvlgegyrolgkmnvewbrogknpaqpcsbkycqwjxvifisaxrytaaxhgiuaiktliguvfnelszzkntcotycqrxyvehvrkgnvmprmaibnwkhvitruruywqiqnzprvuzoicwnmcbuhvlcusolyvjshufcsakenoocqhibjyhqzowmqalhaivkbugvfsrnxkoblhbsiqccwphzwpmtxrzyghjrlslbhvcssyigcghuyhtjafnxoluxonrswmikuqarjjglmuxenizskrostetwenareaxxljehkwtaqngahfflwlqiankuqwjqkzopcanvnjovvesinfyfyshcjilygvnlawplkcvlxvlqrwlviekvpinvscephxteremucrwrhrfwzrcwmbwpvgzpjayrnixkfnzxyeszalxbriobmwbaqfqzclkyhxmmrlaycneothbnzfvjxnqjqlotrejjwiyupxjmnvnugahioxexzphvvlfzrnnjfieegmflbbmyoqxppkhfkqkvyqeufgiltinurqxqeokfypzmvcefzwypznakrkfouotwsygzezgpgetbtxlomjtxkaonbauxwhkgrjfjnnmzwwteatlnxljuqbzvmmgvxwvnnvbojeusokgyymsmfxxhznpjbvgpqlwspbxhrjoiqrbqxmanlwfzfcpphlnbhhkbmaztlwqakpqwqakocbzqmayiszcxgxtqfuyfpgtvqcmhzmxpukfwfxrqyinvcxqrnjnvlhatgkbczspmqtaqastpbmkocvkngrmxhjvgshzobenjrlioaucfclkucgfvbvscrkmxccteefqvakezjucmuutzbvbblvbcwkihjbiocbygcspnolwiibfzuqlbrsacgupnortifgcgafinytjprrrtgvxlneaobpxxbboltrpnogazomozrtukypcwqsjtxhofuvcwyiogifngijmvmaorojyiazuasjwrwhwhoacuejercqrpcqvpyryxspscxxgpeofpwxcaylpzwegvliejnpisglpeovuenfznsbmahjmijubswsxiazvtfqhqpmfmvzytotnqncahhcshitzrvzasjuifvorykfhahfpsgayjtpcjbhvwaontsswfurkfjsllwmkrzjahnvbphextnuakmfjinzmhkmchsucuvofotyvsllrpasfytygigojkajurubturosvfqcqchoobsgzxtqbfnxgfjnqrzjwqflaashxarqqferpqakppslasjmcyjcqshzjkrhoaoireynsvvylgmnnjkbhxrojrqkmxsxkflyjhlophxlvrynpynhrfmjsfszgbbvfzvwyfllkoajhbxgomylhyxmgnkhcnrwteahbmpbchyhlomejpokujiahihysofemohgyrwlazpaflhanhshbzbhnribmjbgnxxejlnjkygemqqeyyksaneuzjqactxowusnswzuqwuozntthpqbmgsxwcpcisusxfutvkfvijxhcbuifqbvrxumxwelruhyumvwszpasqmuxiglpbpyrkslbbqjqchucxzvofjwbjpmpvoihtnsrubecntigusbvjpotczenfrczttaqnisjvxkrlvrvlcqtiqibhuagrqlwsckmjqzhkanecclcvibcwwjeoywtqufpxvgjxglpczwpxfxxhlhyhlytnjvomnazplfvhewoywhzgwsipbfjwvohjtzvivplfluhcaxnwuoagejywvpqgbashnnkkgkuwlikbjrgxfofkibqcheplchmhqvswkbphxehwojwqbovtsmmqqrixkbejojruvejsvqleroslwjlcxkcwuyokrzqjmrkehqytvqyovcwjsuatiihspoqvzfxfwsvhbbllgjgpbyiyngioezxfnbimfwalewcyaugcwokhygosykzwgwurwthupronogxrecwfawvvvvgqcsjmqrtwzsuhlivuaewqqfioprzaashwlugwmusmxcthiahezmneuunmhksfkgerjuqkneefbxwlqhmaonkspnpihrhzuxoryozqtsyrbnvecbvlxwelxpnfpornnuwjegwhbrxfcqyqpzbjfewcorcrwyybomelzjwkuopoofrixmlrxrapzphopozcruukwfjviwweuorjsjcapbrpfjchxxtqmaxknlvmselgeyvcsegipspsrhblpbvbolxasubneglrzfceupxqvflkpteqngsmhzmsyfzrvzelvtioqrrziywfhiqukvjihivjomwejzefaxfvjjiisvkhzcqlamgkzjrjobpfqipirrxhogbjsbgmxwhbopkvgeehbleoqsyabflamrshyvfwvejrcrgxlgqsocbsrhoxomhtousomjyfjqkcleitfihspimlbrrjuknjgmywluogwmxrneuuymmoqgmzckwlreezfiujpjipnuzimtrxnhpgatzhtxgyafzacelmhlvoipbraarfpbqyksnurcwmblantvqxizwqpiyupkvxrfxxvpqvigfxtgilvjfmamiezpivkajaqhwoqslntnuvgzsnbrjepktcgtiqilzxbxugnlrrgxemngzuaimawtjsamngryxwgoqezslqpaolzwigltsvaykcgxfaynxbczozgwzscmxatuteggpbhenbrwqgenhccpayexxkngrkfupllhrtvqshwghvlcowilkakmcjembgsmhjncwvqhnvtsiyugrolulqtrkjnlfcjzskxahxuyflaefjxwawyvmygfzzjhgoemtypqjxbqntemqevvqbartgthzimjgwebtupvkiwimbplkpnvrgwnvfauayyyqfyzmqojfpzbvjghloczcobypkqlaxheelnzgrgttawmamfxnugsnbhoyxuzvbuihtkqpnspjngilssbeuxquemnepglpsfmzotacaklqulnmzyocjcgtwvsnrwpvzsnetbfretvzvxurxmhzlwotnixijwlcjylrucsaggrzrufzxnthyplrnujruglzunslrqwwlylppzfnrzhmfopiwqszlqvrmyhyeqllqbtupfjueqavkuarlkefjzhhuytkxgzkqinkxxhlxfejyovaqknxuclwggpyqnxgqualnmwmppbnhflksoartqsyiizaqqrvtkkxheuvueyuxmrlapaixbscqypxklfhfygpotowlktkkhmlmgjgofwcvfuwkytnfpwvqwlozjaywyhleixzzyjbvtlchuohuwhrstftgpotsgqhivabkrlxqbzjgozrmhijohoicayakrfsrpellnrvujbpbrbtnmevfbpgebohlkmblwuzhjbjmbgfyqswlklunjwznxaftvrpoxyhivuiaupjvwnkcrnzgjeawxhwcqwueorjglqkxozafsftlmclugwrbpweisaiestfrsauixxosgsafmjwayvfmjkgmrghuugpffffclpbwhzhaqpwaemlhgtezbzjemzyoxfoexmpbxmrauckrsubgcyxzzjxkfbbcvfzbaysbssfhygcobfprmbyangqwfznkkilleskqgroxwqsgaixnpgvpqbxjjkgvbyggyayoccrewrvmixragnzmybenkawiujxibpqltfamvvqjylsmcraaouxupoiotybblelhktckfhchllrxznacsmsglvihrljygqvemqtqmariorkigyivzalezuxiwqanhvtqessxyouhgmtzgltxtgxmfwtxeelheoknvkoqitkrsfrkalvquxipiumjfmhvbmwtlcjqkcccgulsmbjcgcvpaivfjwrlqmuyjnkzmzfejsnraspkumixavlapgmplnpmeuxttwkqeqvvjawqchltrowsecsmvvpnkumpnmcypgzlbsyjmrwtuniirtyiwywpoyujxcpowtosjymkutyriovwkkkjoqxejythtiqruzcioaxafycobnpseogftfykwwixnlzgnppbarucuuueuluspfeyxfefgrefawhlaqlzsyhmslvzmsoamtvqahjelznzjjvhomcajwyrxmnkbkniqngvecvmpsffkmwyuqczmyzaiiwxfbbgzlfhcjhcrjtwjbxrbilyaqwlfuheeemennzbqjhwttkyrjtfjfmpyxerekpfugrmotoryghofzbbnoplwioxqurgbnqemwxjfotjerpbjomkeqgwnvhisumwzxvcapxkzebgrauyfaoacxjifeptpvlfzklevkaftefrlitmoxcnzjftjqjfiyrconrrpthjiftkxzbjfbhbrfievqbiicynaqeyovqyrehnjnknybcrnhputqxhtchrohahqamjsvpohnpmcwoayjiclcwvlrngxnluwrlzfltmrulrvxbbqraswvrjeciifinepqnjhyfjkqytxgutpwrumlxsovjikxnsrwczhjnyumozjlyuuqtfnizqrolcmtuqzhpxxqbafaqneiihvrcvephisxknjjfkmzbnvhhqcuvcotrsnutsvccehcojnacjlqmubsuzrbcpijlwctxouvnbwmpyutxsfpmgqvoiltoolhijmxszhmnbcjvfluxpyxtegavvnjrnlkqwekqcxmmnmoebqtlwjlofgbjqazkxnqptsnfjphjkrymttltjckmguhvkxfmeovvhtmuwsxwstnnqjhltwazxyyeyagswkiettvftafhtblayxyhbmreizxvoqktutkbhxbacpromlkphhknytwhrwjbzivwuajtsktrenyokclayrexbuczgpxluohwvgzlsccxhqvpjmgjjiucuutyzkrcloeoyyknxcexxrgicwjwzkfkzzowgneajjmfaeborqqcixouyzluvjfhuzpctytppnzsxlsvjprainqjtyneynpkiusnqbvebiqnvwuolcnponqmoibkmoxoeqkqssqkimugceiuqxjhrpvecpkgorcmhmxmrqegypqlnhmiajqvvsusrspknbcpwomactzfqtzkcjxiqxezmcownipfxgtqcuoukhazrgteetabssujahibrklgybqxftxuveuynjmkwhumfwjpxlvithhihqugybmzrpjoktqeihujokapltjqqgyefjmhajhpeucjeotzuerxigrnitahebahfefopkkfhjcjrzciqyhehwmbveniaahcsevhzbcelaefljvpgcwchvmavzulpqnyywtravckfqgkflssfezutnlypekyxyjifjaafzmleasspefhjhjqihgwfqrkaxiktgwlfisygjbgmtffffotmvhwpyfmrysqkgknreoeeqwjbkouegvtzxsmbkvnjupieswxqoiyyuphaeasnwszngwhocppjmvitwapkxzpefinklmxzhjnzymmomynvrjwzujkqtvwkghgsqptncbsuyjquguyhacfbazhugsnuftjearftucwrmqnkeasuwxyprrcyquffnipuvhnynwavnhsbhhnnfvtemwsrerlbrmrfljireyxtztvlwjjkfzpmpwqfevanyygcgyyiggfakuwwxkjcjgwsmglhweryjyykzosgehzblmhiasbpnvkkropjzikayztxrombjybjyyfosquvwopzegygtcxcmtiwbpsglrnkkbnhsqkmxkkqexasljfuifmknhkjieajwncvagcbotzgivwkxinieizvhsqovwozcqzkctphnzcxcqlmfpfmevnjrealeqgarwnenxhvhvvihxfseztnfkknlrzflwwpiwyqxbnlblfhuqoqgbystubihphzyngaianjrgpkkjfvlzwtxigooveklyixixyewwyavycbzjwplrjbrjsgzmhentzostjthhsnbukuipcvuyfuylbutkafofpbwvchohvrkstwfvzflhpypombbpnnbptnvilwmhlicfgnffjczvpsoihpulptcjxaxtpzyzuykovvbwlxfurgwmbkfpturlulujbicqvtzbnwcotimgclfhhcyhjxopkszjkejjrlnrzexzkrfhfznsokwtkgqgzlglhnfhrnqxmcowgeonmnptfninrrbghyfysnasjrqlgjcfkvomrixrqfakesligaqygitsfxoeqqtpwazicvzxtfwmjxaeozmnpplrzrbxilnalkxhzxwszcabaajbbzunosibmotqeffecajrsesxwbrfvilhlxujuoybcoxqbipfagzyqzylgtklhsntolhkgwoqzetwtcuambthhlafxyshypgfomaixzwlqlaengwlgrluvnuagrqianfvzcbwvlubnjvkifahvclepgikezzfykbxbgglazwhxxwwxlnggyfklazutaslcyjpoxuwqjsvwuyhpgqqtbabubhwyiyfuknlzcxlprzolmclgttfkacspzfenrlcgpgxpjmlhgrlvtwjryontynmfgmajwqgnavzxfwhmtzzzwsrqiocluoovfmesnkzulmtgqyeqshvcpocbjcrpkyvgiaclbhvpvrqnvrwaavjbmzifqmntrkxsrephucfutvguoqvnojjvuhvlggkbpcatjfiajquyocqoesfcqzoqhaoirfuptjjssbfxgyclpcjpopwhefenzkczjywbtenxoxlpecimtahfiklmxnsglsepftjhwiqjjbourlgyvmwucrhvjegiklatyrhljmpjwmivpvkwbvqmznbmqkgqabgaarfehqxzjzsefavcbmpfkjkuztyafsslpiumvwzvumsrryezrkbtlmaijaxgkwxtkogbjjzfwjmfcbkqvmzhejrnmxmyvzbomrrfkhebrrbykfvvytzicstllueaveljrwcwtfmgebnbckkevfqzcjleperaymrbnxzgzfibkgezcxhocrrocxkkofazhselaiqwhxonfycolajvekuphkpffzpyoxccqybcwwungtsuficnujumlblaogasuhqpvpijirsxsyihwxyztnsazfiumxtkqmxlkrswztcrsbgpmhlgcaigcrgopjoznuqvawyistbzlrcfkygyjvnavygcatarihgphwwpqutfwqnmuggskmlelgyxpclebgmzvggmfxyxprtggwfnxmbbricywbreosxkocqoctniqoqtqfpnwfmzbtjqmgwcwokukvjajtvphjbpfjtzurhumouztjcsaitfnvrwwlebzrxbhmvhkffcjhgveqtkwiswzxwfffqhxyhpjihptqteliggaasznzofxcexgrcwpiacflngtojkrrmfvumifpwlwkfbquthjnitvjxvwneotxxwcgxrjjvislbxynqofviotxzisnsvtsckkezvfmogzhmosuwmqnratnuexepcfbqipaagffcumlmumiebfnpyagnphfgjwirqqnfncaoxwpepfzharuaeprvjqbullbmkvrxkftgungxjylgcpzmloetgviruiecnnszquqycnhytnvtmebsniamrsmjqqeachmwwllnhtezcozzraebfwsrjruznypeqyisktwwtilscefpbnrulfqzyxnxviumnmeclukeqqvipsujbfsrmajnlmfykqstzyabuagstppunfjwizsqwtabhtwvafqcazkboqtoxmnbjbychgmlrfqghbjpkpczxruibzqbsbcromszyufqonpxffzroacghswjshoanlxkeaskojysbgxykfbfjwjlehbvcnqbsvffwcfgjqeaszueizykfmogrqzefwhvnwbegwteatcgsxiarrfbztjvlevfzofvmwhshykrkcffluhtogfmmmjmsvcjhgjpzkcsaqnhxnpjozpnujncbruaslgsetxccghuemkpexpixzpiungrgavweicretrcexpfntwjwiayafsbburfkimrwuuhxooqpsyynwmxmpimxukbttbeugeihjnuqvqgguanizsetxcoipnsaftatkqbkergoljmuklriekcjaalivkiszkmxpqfofwlyzpfvsxulfpbbazmyeubuutwhqwmlfwwaoyuvzikhglokmnkwwouasrzlvayarprmmuimsoxyxhnirtrwkgiycevtxxujcbogcgtnslnzyhfaoqbwusjwnrltmulzaxiaiaifejbyknlnexgeanrljpqrgfrsjogiqyvwxmjfsnnefrlfsbcjkmzyvomipegfaowgzcqrcypawkgfqbcgcgyhpfnilvmxsvvmtnflnyxajlnvuxlpmfpgrgftpkvnmwoajvgpaacvykvyrzkfycegjwobzvtwjapfcjxxvjjvcflggexexsskiipxsglxxiucgpwlpooejwixxaiwmjwrctmepklynoyigskiteptopuznbvumlieanpuaptjxqefahogwzkqnkmmtoynrqienycxbuatscnopzlhpsrygflekxjositjgkrcpuwjmlukxvkbruvbshfusmgbrvvokjvqaaocrrzaggrztpgyqpttyreqhpqszvrsjsboocpgfnhmuppauaeyekbfvcyhfyepazsqbxivymuzenmliwarnqnmpglowpnmykcupwgvuonporqchovxlhfiqrnwbhngtslxsllibwffpwzasxtuxqcsfnyzckwynzifuxxrecahzmlbslieyggolcnkhsrwhiauikuszstooskixucrnqggvqsqzpvvgrrscrgbmxrkfwuxvwbcbqhqklmkyomkcrbnygvtmfvnrkrvvjrxkcfhjqthhqnlehclzgeqmwypwkjbmvgqteqzvyexmafxrcwupbhbscmfxvxzllrqqttjpqpfjoaxiojihfnrvuemrtnozruoshyawofpjrzfihqocpegwyticupigtlakazfxgteqwsiypmymleavrnjwskfsvtjssijwqatzmrrmzbssjhpgfcwrstbpmcrsenyiicrhkilwrbupjrtytuunhrpsbjwmwulwqfxpajxzagsqnnvqqgmekvtwjcvpvyffhssfqoslqpjakmrprczbtpzhcfrrjcuybtlaxctkabrlomqofweiiwusjufstmvchpqrxhjczayepxkrtlfqrlezjskfoahaycyfamxtnopiijwvuugqmhgmegpmlaevknozutlczyytkyxtnfbykzplsbstbxbwczzerlhgfjjersztrrroijrbzteimhjcumxgrbejrbxsziljxgprlnvgfccwxubeneplfvebqnjjevuuhqxcaqpcqhlqbjxhvrmyxllvvrjniwkmjeuayskybxmkslrtgiyghykrpbpqhneazloelzqvsyiltrqeptpzciixeaaqlutpefblmbamxajtxpangpvfnwnifjyvnmcyeiobrqgkmgsrqmfcqycjragnxsmpuxykrmoewzhnhqajbrocpchbsloevjpyqampcjgpmrmjgtwkjehzoxcbwozovevyxxvnmrzwmtfsrmcearplzhyreybgyumtpquukouwjusjlzesfackpsgoafbhhyjsblqbzlbbcyptxbwbzlfgnxuubfehoaiyebbqfzjcrmenruebzztmtuavbgukzvbvepzxkwtssolzkwtrjerftebqkhblmrzkpbswcrnaalghctzejgmwwnwqnfienamtwoxyetbejyiwglbtgseobebcpgqnqwclccwmrsbpgcqpzaoxqspyvajfxrvymkxjwsorkcpboxerovopxpvmmwwvabjuiphegplieyhaaapnbfrmkscebbzjqrifffojpymgqyvpipanywcugmsnkiljfwrcvtilbmgzfhlqasokqrmaivwzrnzxariepvisflsnhvrkghvgjqbvqfsxegglbmwitefezpnayiyrfwkaecghzgptzlcziivaiirwjhaybucjbnuqkxfltjzrppkkkiskcvurapkvxfcegzgcxxomlkhcbpezygfqphsjernmsfgcnpgbsxzusuepomogepysvfwcbzntmqtgyppryukliyyxotjkvgyyzhzlynkrjobbcphmaiyubunscnbrsqroeyxtubgcqjgzefgmgcxfkuyqheacbzqcniphfmkgwhhckqkjqrlouvylpxqchgwcigyyxflqrmhplvnxbcrezfxhlcsjbcsighixjqmhnsayopkzzhzhgmpewnlyffrqlyglxxbmjrzhyxqaajjuotorntgkgbiyqcrzztaglbzqzgmaunzajwzetpopbyvxukibbclqpsgyfsxnswjowuhoxwacntabxtegsmehcuoeejtohhugypzctpjeqswvfnvbvvoskukmnvcfnzckttncigvrgvltnmqhmnrfucmccncyxizvntlsmuciptxapuhnqnlobsjlyfmkbpjillkrazavwbwshvawqpltqkcrwhycrmgomuoxyibfrzswjnxwoxekivhxtpkethnyaeanoztyiismkmrhfbxgfeitigtemwxqiyrgavyetfplyajucfibzqpamikcaaaxozfcbzzubhlqpbfbftiblvlhsauqlijfrhwfnusmxgphxiwehaubqawfplfeqjxnykjelmwhgqkxwbflptohtlqapflpwtnnlsksugvywppczjqottycctirsbyaiatakpcfhoxuuinmpkbujxuytfusxecxckqvtxmcjxqfjxxeslbkcxnbzbqvuyeexfogctymzgskhcrcffjbkriwzojslxtlobwszlmusgxfezggpsutbriqwtchsknrcofghpbnswlrogwrneguzjikliwyfzxcmkeviowcbsvrpwuxtpbwpzwsaoqeanjwboempgiwwglatctmseqluywcgqbaxmcrhieepwiohgcxmnwrunmqgqoxijfqcuheqparkxuwokkjaruffbwntlhnsnicpsofghhmcmorfmagzumeyijruervnwkpypqqgjafsbtyaojyyycooxexkpksjhykfqbptpzklgfxfuekcpwjwbaxwhxqmqbmpzjvimetfpkzsxeggpajkwehfqavxqtelqrnpahhjysslypwmhfufspwzlftuehzomcbxkqrhjvajwfjskbckepxpsbotcyomcygrjyntpfmrrfcsrxsybkqppcgjuolenpsjvgbfeckvjeqhktojgjvzgnkveaibgyqhgigzxaukeliezoykoofyawzvctyilyouclkmyomgngfokzlevkjyxnhxzuemvlkvyjmgjkqmyynsxkuqikweeroyrjmgcpaamrzvgomcxbxqlirfvtsscixrrqhtuihckztllexgvvocxtopnuqbkunlaozvgqkjntyuztllzvnemlfkaiclmlhqrinuplfkeaysxrrazriuqnmvbeorfwqbslsxmqwrznphhviyemhxxuqcxqbhhbjftgqimlujpqnpiarpzrsonfqmxojrnufgyzbxyvufcnjjcksfbbshxraitphhzxjuhspwfunwnusvrzhneusyfjwkfounlnaugqbegqgzryxstpomceoixytgwwxmfgzkqvcmezqirznuirnobtlfnnlutabmatcmzfyutwboxzgckilrvfztsvayternbfwtujsrvggartlymopoynxfqlvloaneylmfxhhzpckvfgfylypntujhicrhckxqjkmapwafgazukoboytqyjannaellaklogffygyugwaetbnfljwfniveuxzqstiuaxivbxbnoggwcgrchnjymoybcnofnnsojqiscnvmwvgvunlflwysqpaqpotfpmsejxuglixfrffllknryemtfnflwecqpjunwkoqiskrxqxeyqalopjufmlotvrfllszkshqinrnowisrtgznjkjbjaaaglllqqneaxxhhhgqabgvqwxraaxzgmboqzhyocrwejvsjksfwmatzxkxsygialnjxwyytwajguqharexkshszcbgnapwhqgcftchsszocsgmhpumqfoxusegmxgaiezmwkappsgqawibzwawnfosqjnnejipmpnxobwtmehiprcfgzlwfipvekxtcaiikxssmesrwbyuptokwjewzmtvyrtpokwsmtbtkrbeqghwnkkavkqehqsrnliwpkvatalsenakocchfjwqtqhfknpkjyuifqmspxqlcogtpiwnzwhoynyhfoasfmphithbfswhgmabyfohpkrnsyhxpsbjqahqsmhnwuynibtptqemlcvyihebxircisijqyxjfruakoywcqczjrtimzelxaobuwkeccveaawuffkabzpfsmntfeyhuxivyrunvtrngzwyfvkzihaxljabcpupxhkxespppejibzmcspklhousobvlsapywsbxmviymjtxubnxibblfvtjghghqnavbsvguokejqhjhyzvsozkqoxrctklzcafqpswltuxhgsxwsbubogkuskpftvoojympgsqitmoahwqtljszqrqvmgffvkjoizxolyjrfslwivxsrilnhmzejwbqlcmizotgrmxcosueqiltmptlwlrrsjkhcggqsyvnmemfcantulcjkwzbfvwaoghnailiiurfrcaebmpbegmpuwmrymsrasubikwbjmcbaknurokhymfqsewxuvxsahkspgwmxvccxyfcgmebryjesrqabpvritgixhcuyrfzpwqwtgbxvtbzbqxulmklshpjzsfnxukqhxxjrabotqqqobuppbvnzypruiefloafqrapxqfyvwoqhuwpnconrgyokoxuwgulsvmmlrxrggyzxbqmcjkpjtoaelxcjwsmijjijskhxntaxjnukvayoeselpuknfmboqpxfrwtmlusgrfcrlonhyoebvbwgxenroxnbvsfpitzwfvpubuzhauxiuexhhvmmuuthzykzfyccnepmflkfchjjjccafcfwauganbmatlsumupbzhpibgcarwyoopysjhboxvfklnkzrkpwlysrsblzpfvwmivpvzpkxmzcbforyimzfmzqtaakhevtpvxcihmaqxstptsoamjqbqtkbgawqohhtzsofcxooaunrbjfgyipmjpnklqtbyblbslmryxppbolqxbqqktcvgijaxslnucfiurszgfjfhqovvyrjsaaigjkipszxialcchyvbnpyqikwvprhhyiubhmnvxvuoinwzxkwmavihpvaunttazeujazwpumlgoruabblhzmkxpnovkhrvjvuowcxzbjosctubwhivypcntpijcocioejlzqnyzsqcfmlutmiovkettoxriwxeiopkwmpgmkswqtprulrjkmehgajkkolhjfehjrzpmqpljibkgxafyhkisyywxifejrbkxbyrwimytojzggvkxjvreycefezujtyxiasevabyotxroolvtmociplxuyacjaqynhqvjpopqlpktflwwiojcyerlognuswaemwcwfxuvlyapolryebclhpjywhggckglmvevugcncewtsqglwefiwiqhqmzbiamqhtkupzekpthfkggvcfjsjzzayiwzwfglpnhblzucugssxlppmazhushyqjjlgbhbufpabtbviabxibhplpglnlfaulkggpemqtlveqkbxetogtapzbjeapxbukbhpmsseobxenvpvrljguyffilvgbmuhfawuysoiksorxojkhoeogqvfomsofbrtqlvantpouckmxjvmtmrmtoaqmyobrslvxnnfiblgpgjvsavfgjywcyfjjpxpsrjhtvsiweuatpzxzuofwrkisyaxhqtwouehzxskswbbjglqbacmbecsqgmvuekssiogymggjfwagiixohwustnfsqkifwmaavoebuuguornbnofybninfllebeyzyogkieeieggssfwftthvqmcozhrfhuprpogesglbgfoftkjjqjmjwmxtybfwgjrjtzqeckrlnmwsmozwuqiixucgjvbhgxlwxwatgvlakyugcaekvynpijmhncbqquuetvlnreqbccmaaiispaytgqnzixtzubuqtsfkqkarcbaysihuysvfgmpmzinatibhkjhprqthhmgsrrosmuclzggjqzkjniwvpqktjzfifpbtcornscbrpatyuitctbascgibspitexaxsswlumxtatmcexlgwszvuqqexkgeorfjtfhpzsjrggtyssljbibqtktauqloxabslhfmbqylejjppepkiskprhonwfnfortrthhyxlgtfwsmjashpgiasqaoyjgjvvlbqyxocutuvmswaybvcafpusszlkfxvhlympkypienkbxvlwojmtymkptpatoimpxuslsznbyjqgzjmjqrliqevijpuqztrmxrjhlfacbxiebppkmfmgahxrlabliuyqhjjpkwwuwnfuluqbeqauybyhqglirpebhaymgglofozjfuzxbltwzfmsysiabpycsnynqyogcozxnzanqagasaopwaaxkkrbjcwejizcitxykyaxeifyxjctrvchgvpccgmbtlqgexugpylxibbvjuhnvtzkguzbixeepjozysxplnczjiquhrrhahjtpsythzqbauqkwuasxjyweojimmjixtkknrqglsqmvnwfvicstnvmltiovyxuphsmuvwolspnkcuixekoetpzhituxtemkxtnruwmaarwfivtckubaphfgnnsxjsyipymcvnpgnwtuwbtubibieozwasbwnozorwtomrmnascclbmwwrlnijthjpwkvqbxjbaomhytsuqvwsyrhwyzolmtoegrcqtultmvsyfywbgjfakyvgbgrvinmbmbnzoevnvrmhxhngmomeblhcxpwqfynswzqblpsfxbxbyahjezebnuuhexzkplyolkvjniqzvyfczfqrkmjteaxbouozvgntxoyjyyynbjuwwbikfmhflgyuxzjorevakgprlnftcielctpvnfnxuqstbfbbzenvoczyouwmxzbjxmaenkpegfjvvttujbwxposnycqzmllritqcxtteptetiozyqavzmixinjhkiwkvfbawacxtbwvorhxipevvgyafigxgjhozxxgxiahrfrfygnnkouuzvqxxzthewfwhzzuwtmflekjhrqznqkwlvpyxlptbefmukyahrjeeiqpbjyhifcijefgwqiqaovwsvylsfyoykbyoopfziohautqusosruajmirlhzpyuesjhkowerhzpywwkaferpqxgvnrkozrogqbuhxtxvoqvshsaqzlezrguiqalvalxzytafuzbegglifeaaomiqgefglkmznnoaevwtxzcmlnjfppwxsqhnsplupuhbjtlcvbupprvhsvnppfvbsijbqgzrwbrvqbbvlwqoitosimfeovzahwyeqqnvkiizlfximaacnbywmzlrzlaootshkbbasjihhgqnpphikcguarhynvrogewjxxwpuosiwjsvamahilwsprebserjgjhyjrbekrjrlnjrgaklbkcgmyajlnkiosrwfqrzfnzitsuimrfwebucyyvqrqtwojxfefrojxluktutinqxyykwavwhxghujvhnkyyimwebenmarypifikbnycsyhhmhqajcjtsorbbwvknklrablxagvhnvsmslobmpbapyteplmcnqzsmunfhgkazxkjibnznoyinhymzrepsmhafbrpblejbqxmshrxwbclifkhsszgjeeltqbtpbueautfnbpkpauohyfyiukoxjlylqyckowobjupufzlqgnlqvxxbunenhtiakxilqhzssntabbhhazmkucjgnysyebjmkclwewxgbihgkvtvasuiuwtxnbaanbcnbacaoactafkqhqxfpgmxhowxbeauvyloxuuxwlqricneivhlhuvccvaaygpfhgcsabreyurqzkvqxnrouwqoefkwfspwapmecovzxlwtgfrlltgilbioxoqqbutlziswnlgvbbbjgcvobwpyyebxsgharakujajoigqbzwsjnlfhcejyochpitwylziieqzcnthofkqrezpqqoxpvivoennxxanqmvpfqtevqpfisvwwmxppsnwzittkvskjkqqwmwlkxhzvqszteoknbpztfaojmeoevlzqilezgbozachqefcpnylfkipphqqbazgtjlystqrktofqgfgoayfbkwabxmvfcbgzuwfcaohekwosqwsqqrzvvzrelkbsugsmesmoikagxzjhnalnkyxjgqwertclcpmibrmrvpwelzymbfyyakpqikssplzwjivmhlbfwekksettxelfvonnhqhqnuvitkrhkofucyzycnonpttwolyyrtvwiagyoczzksupjpphffmbllhftannxzzjfawaycfxrunafiqtyfseskfeufavopskuqkonopevfqzqgcccvzjigiksbilfkrxjtkzzrcktukvrqpsmuosmfrtefocyhnwbityzboofzgaiugtbqcfuzenwfcjmayyytglcqevnfambfijqtobwabktaroyczziacxfclgmmxmkzgzjagbtorutofrbvutzgbwfvffebrunksblyvynpevwinxcsltszevzlwfybbengiouytlimsyloqckjxkrtcqcnhbfpexcpltwztjpvswngtvowstbeehhytxxlevltcucpqoqiizwovhlxapfhhchtyfbasrerxciqonnffowyzoonxyfgaiiqqmcvxefpilrpoebibfylagtkfrjqmkvyqzvwjnnncoyaonahplxtshverhlzguetbsaurlrljuvqoqluveghvfsbmurkrkjvbssaqpawfregkbezjbrqswbxjccuvlurmbezpxyfslmfhccqijialjyrfsfxzkmrtcoxxhpghwmspemltfnhslwygojzolwlattjtllleconuopfkvbzmiiavycjjasxnfbgmviwuvuzxsuqfetzcbpmuspcielynwhxbwupfnclequwxcbigkgelpzusexrzstyvantlgxhazzvkccuktunlbcroaqbhlfykibpzarphvgbjjhtqfuypcnyjrbwjovfsqvplkhojxsxqzufblckhkmcrmfcuteymcjqgrxhvnyaybxfiphmqcevhapbowupcnsbtgzxuobqajspovkpcciylpvwniegklvavtwpgnlyckbahyfuuwkkmvpnrbnwnssqnaliiengfjtocebuswueitggnpjqmsvoaqmsjupiylswkytgktkjrjczlyzysafmmgfzeumwbiauaqkykiyxejrwotwzyejssvigrhyvxnaiziczcqcagcfaxoovfawsfohlhhgrjlpzjibhqephbrozccvtillfvyblqxuloncbyukhcchtgruhokzvlperxlohqkfvtvtosrxzkuayjsycrkjufoysjentvvlwxeamifpyrghiswiqlmnovrujzswxhaolggwjxnskgwfaaoxlsxonubspmtrqiizlqjjanhegbveazlbhpgifemfwhoczurrhmilsmvbnnkpbnmftgtkcmcqfthpquyuhklvzaliyvqbewqtuesyzytuoifwalglofouigozpcuxjekvxnssskkvaiyniwasmpmnpaqgijpczrtfqepaglhoqmqsozvvshaekuhvvblzzzbuvhoytasslegmsioqifpxtxawreuksszyfibaimiviavbzjtxjnwitysvefsrqpatojyfvcyrwtboifxzojzgebozlclrtnmtnafljsqvbutqkobotzkkuiasvbbnzjcylelrvgcnmuqmnjbqytchyxullahfsvbnvaxumuivywojxejqokqyskfflkzjumhekirpbikybvptpqwzwiqcaiqjnqozunymyqxywpioggxfefpcbpgzyxawuuxpvvtrhlgwkmtevsfyexyiaisxfkqyuowxrhpfofxegcbhgiuprperlscaxzasftnofssmgvqpnvkhybmbwjguahuzzsrgtocamnknohxfpzrqrzihakjrxnzhpjwflaefkcmreoqblvjlljjvrubbsypiezygveqqynrimpbauwrmzohwfcqvmogefxupcjalbylrhwwsnmpawrkszehfngpnrikvnshykmohslcyfbxqkkzjywevurbofagwhbuiguztavuefzhhumyxlnjfxunjqzcnqxjgymoggyhgtgxztbcpfjelgywifrzyrantycrctrpsmemqxttcxvwlynspomrvmkivhhaphirmwlhxckgknqeqtsslaprxslhmzwjbgwgmofejafcvknbfujuejziuubwpsclqqhgpmqibkxxsbitgejxmzbclwyvhghuzeazqenubchepxpmwhwflqigbwpwnogryvlucwglcxphrqhsbhbrzhxhqaqayllesbjrulrgpxcjignvcercztptvjmbbpatffpoqpvexvxcpngjrzbapqkeukznixhyywmtljsclxrbktipcxvmxmqorffprauxofsxhkrmzllezmmpaunpnmkjhbtuzkzcwriyqknpkvymbogvkkxfipgupbtralxkfjvmgowapcvqrhghhhrquqvlxfsugvazbmfsxspykkwjcpwwjwlbyqvsetiykpnernkrutcbphvibtelkrarbmuplygjmpwnmggqwhmbcytwirzcumiymylvxvrrmfyklybjqlmbatkbjoevutkqgbyeixljvijbxxwbilifmeknlexlxetcvcctzyacirkpuxpvzrqhmjeyqxqeztorujfjhupebxcymfzxzicqxuwvioeonsixiqijyvilhubwimmoqzsmruhmufyjzbxbfttvusgtmgqeyjvwrvokvuishlsplfenkngsblphbhzuwtkzabfkbboysylwykiaeufiilxmezjvthuhvmuwsxcmneomfbxmxbxtoblxowxnbvamlqyelxslqvrhwbzgkjoqofamzkbiubfjlathklwhbimlngmfyuecbttvpngeryanbehszijsqhypepisqngojmsvkxonvojrqkvkomowknsjkastranjfliqvrtbhzfzaxzqklfaabvvffuhmqlazvrlwysbmhirpqktpnhxrxyusvohzrogmvqbkcixcnulchwjcteifswijqkpkceixbcuoipsfuoziuurwwraguracctpctnqcnulhrbsxubtiuelsajhbaxmtmnjgwoxeqwvirruavepfqjsmywfmxhoqfxawxvrvavqbhmqmysyippgkccqoeeqxigjrieaopmbisvawztuwkwecrwmjlmomaiicoqottrtwuxputfrbknisexfsheiztibxnkpbubgamicibjlvtahksrmlvnvtfjppgvsrmjtxgwhcfjiksytfiopujoiiskkzqynxuhxuakfxablvpyomsozyxtuhrsntbfwilkakaerivigplrkvkgluukxmpvfubpivofjkmzjparbahxtkloplyotphckoqqxxylcnhxcnwlhgogjuorslifgvchfybjzatcapssurahheieoqzeiivnbwjacongsfiyeuxypcugbmhfygputhieymncabkgtbzxesgnwysriixarwgmtywhjsgmirespiekjwnqosflucmasxzkvkaivkixlclymquizoujwiaqgxkcowxuqqgieeeslqguywpuvsavostzmrrnrqyxcvmssiqcxrciguboztqpyryfgbtyoemzqssypexthqlgohregfnozfpltrqygpivytkpvoxtgbvrjrfirxsrpwktqrsaniaselhhpgmizrxcqxigtstzrcrtwvvlewnsxozapnnaocmhreyaqfulepuswijennzuhqlzittkqvbnczlowirzbagztazfvcbrehihwvmgugeslwukzpxkepxonkmugfxvcpfghzqzzpxtikbnakkshnmfxjvgxqvibyajhupwmlqaeqhbrivmxjbwkwrhzcwnyaavtbuqffilvkrloeivocbyxcoosopnorghfozuhcescxliniibgrxubynwoyxihfqrzzszsnifarbhvvkosfihgzeezsjrxisoohlowmqyhzytczmqheouhwcnqxjzyaxmphqyibtjfzvhrhuzmfjqwwepbqhoamtmexyeisacprtbqlyaonxcxuvcsnhgyufaiucmshkuotzsqfyklqmalhmienzanlvzkayqqpebkfxyurztxrhvhufpweekngcrmiqkgfbunqhnnbelrhlpgphcpwbwitosnjvweeprtjbxogoaslimbmnesmtohelzyrlvarheogihwibvcnbyizuklgucczpbrfzcwmlquaqekesqyxulpzoewwtqeiyexqgocgpgzvlwpbmezbjaxhbenhrismgrahllmhyypvcglwfhzpvsnqcpllkioxllnnvxxxjnlfqqpjjhyolzstklxjczwucinfhpelssyzwaxovmfnbjssmprfsavuanhtkmfjfqtvyqjxqnwjortbzokholckjknwbwhrojrqluhhcofvwfufrogharrhjwjtgcqqqyrppwztzptucgpgubrflbovhbsqesjhmvbiwrhpnkxkikxyumayfnqssleziwarkanpbnetixvnqsgwglzbrxxmqjytgytxcqjuyfhknrtikeofcnmzfvaqvrxbjkzfeevyjszcifagghtkcqnvflwvljolmqqgukjyfzhoxgtkxwnmyumulsbprvbpturmthjkfwjcfaswhszlavbavvekyyokljhnoyktkxnfebmeqylhbpjfhzzniozbaypknmajsqbcebbistjoaumctzlzkgyfjtvrompxoihplwtngxoaizwwjrokxtvnwvjprqnmokrxozpxpyreyjecqtlktqsavvoprqnwvisoieftuuobpcjwfumhpcgqkvfykspptxgwkcazwycpqfifyalvhjffsgigcnqewglzvzpsmahvqhwttqayhtgtwwybatchlewrvzazavbpxzvgwuvuzpjazpzykeozxglohgmwyhmgouyeqjaypamfesypugonbisholmvynrpwmvrqckqcxfxoshgywxtslswbwvtfwyvpqcwlbkwskmkzunycvucthjtuybauabjcbuozmgkygyregrcjbjnfloirimuytgagqfbbwpfujgimatykkappfakruwsnkyitcmlvpuhbckhifitkgjhotpfpzvjpzbbrjuuxugziyokbuzkpomnqkhwhvnskophypgkrvkcescpxknyvgngvugkzprnngrvpcunjwalplxjxtuweqzzhypjxwvtniucjkomjzvsbticccswlaugvpuilzlniwssyjmtfhvyiycugjwemgwqbbrkuyrjweibnjotvwqihyzixbhufpylgauvnrclfpsqhlzfiffpozhbwyynckrwlbexaclbisxumvpnmnqvkzlznbuzthaojmpzbijyxqngtkswjxjjhhhkilaxrspepmokspeltasejivltnvlqysiwfnwvahikwtmspyjfxwequkestjefpsfviqgumanacqchruqhevqwbsfftacioycxwgyqxzmgbjesjplcaueezxpembkewehpgvrtwantxarazaaypyfcxsoacnayjxstroegxshhzvtpjioyablxwhlauiscmvivhofecagjfygtlqxcyeavviohzlhohqpphxajjmfwjxpmyvlsnmurapkelbkfuplrgbhsliewhttliogtcfgvzkuqlbebyozrfwlevpssjyfynfonkoxfxzjzefvzzrpcwkaiukpfgscolnvhveyelararmmtkkauugyhkigjfpeysbivfbvmfwsyupnzyfrrghhpsvlzvsvpwvhearxrhlfzfswajsizpqeowkmazsxmeripkihbbjofjhitmlcppgyzwilelsyrwolrcuiyeizmuxxfwenwafzvnvlrfsisgvxentatobwkogbuvqohazkzvlegqwteylztijgfvearfoqlqqzuxibbsorfqchnhjumopximamjecpzmqvhaukjgqtrccsocsfwczcytpqtfysexyythqelbvthneaeakgpxfylyerxocjmiohfcgflgkqpvrjfnswzpsbqjxblastpuigxmghaprphgtmapofhffgtltxjypbystwjeobrlhhgqgzxbyfhffgbbxjutrngsmoyyebhyrujyoxlgangiswqywqjizqzqkplzwnwxspcffhqszcchizhikgouzngetkcxzvicfqyrsnfbfispeyvyiicxzjwsigyaiwpimjfblqappqiyfeslyffjuvuirjfwuyxbjvuhchcwvpjsqomcvheawvqmfiultxuctoogqfwmergyymamflrmpvatypivexgzpfkiloxivugamkzkslurponmtyutqucqekzosuwyokrkjryzfezajbiaavierlkcsxnltqufivleqebmghwuzicyutvqhzgkzezahztvioxnrgfsliysgkyoxeqqthjrungbabezgzwoatyseibxcqrfskjjnkweajawbmfzfxrblowgptosiakliabtkyhvcprlyufpojecpzxuvommsvfasmfxgbnqqkziabiguvbiuhycrpswbqxjuamiihiwlecvhgtqxixtfxvqnopshrylfiinzgkxiljuzneswswzeuawuxewflzlrtxateghhnwxblbftlusnkyammajxbwtenxkruzmwkjyvaacahjguwwgiqcnikhblgbuklrettorvpwfetampiuvknmitixteqmgstyajophjjrtqoxiebpuwwyttvxpmoazhwfrrgsomlzyglfikiiqhpnewkxghwijwxlxnyitomafaknfczjrxmbailtvyhuttjlbxmwxercjoziugyfzvvwussqhygxosmtckqmlowwmexlbpiuzhfegjuzycgwoyhslxsbpnozxgiaowqsvuhninqrctlchoclicqrjzafvkhgsfpcazkbpirsjjatxtxypasaxbuwxaxlsvzbinrvongyhgkmhsttlkirxyubmzinwfmfezvukptebjvatjmroygeknfcoqjsosormpsgnfaazhkmhiujruobcjksvnhyxjusnkwhcjffmwazuaxvqjunqyelyoxtpqhkpagzustkxxlzvkwsbjtzjuiybrcewiwhwlzufxtxxgkgncavcxmbajgzvrgavjeeshclcmwleizscbnzcaaulfjrxjrfqblyitsguugbnbctciwzyahbgcbrccxgrzfulkbinqasqiomlzlfpeyyizywmkxfwhksblfhbocengvtkgzrmzhhzcyjqqqyyaeihfjsqayvhyaabftykqzfcejfrbmvzlqybxhoozsevmknpxhpmmfibmnligtuisopbqllaqmsrsxxtehujykzvwhjffmtmffgokwvoucuxpekkqphtybowfcnawuotakvnsvmusugbrsqlrxcgfemkjkjwsflxvgsvcmmjbubzaiguztuhikphnuvoozpurimqlrjslstbhwwepvxzqowqlvawplszgrcavtlqiyxqtajfjoeaugpcejslbiijgqxoemmaxabkfj' # noqa + finalTestStringT = ''.join(random.sample(finalTestStringS, + len(finalTestStringS))) + finalTestStringT += 'l' + case6in = Solution() + t1 = time.time() + case6out = case6in.findTheDifference(finalTestStringS, + finalTestStringT) + t2 = time.time() + print ('Runtime of Case6: ' + str(t2-t1) + ' seconds') + self.assertEqual(case6out, 'l') + +if __name__ == '__main__': + unittest.main() From 61adc88547cfff5a7f37f2d52f8e40744286131a Mon Sep 17 00:00:00 2001 From: JakeBash Date: Wed, 18 Jan 2017 15:55:49 -0500 Subject: [PATCH 75/95] Challenge 1 complete Completed Challenge 1 in the Java programming language. --- challenge_1/java/JakeBash/Challenge_1.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 challenge_1/java/JakeBash/Challenge_1.java diff --git a/challenge_1/java/JakeBash/Challenge_1.java b/challenge_1/java/JakeBash/Challenge_1.java new file mode 100644 index 000000000..e44188bf4 --- /dev/null +++ b/challenge_1/java/JakeBash/Challenge_1.java @@ -0,0 +1,41 @@ +import java.util.Scanner; + +/** + * This class holds the code needed to meet the requirements for Challenge 1 of + * the 2017 Year of Programming. + * + * @author Jake Bashaw + */ +public class Challenge_1 +{ + /** + * Prints the reversed version of the standard input supplied by the user + */ + public static void main(String args[]) + { + System.out.print("> "); + Scanner kb = new Scanner(System.in); + String input = kb.nextLine(); + System.out.println(reverseString(input)); + } + + /** + * Reverses and returns a String + * + * @param input The String to be reversed + */ + public static String reverseString(String input) + { + StringBuilder sb = new StringBuilder(input); + char forChar; + char revChar; + for(int i=0; i Date: Wed, 18 Jan 2017 14:59:24 -0600 Subject: [PATCH 76/95] O(1) method Earlier method used Dynamic Arrays to check for palindrome which took O(n) space. This method just reverses the input number and checks if it is the same as the original. --- challenge_13/c/karanchawla/challenge_13.c | 91 +++++------------------ 1 file changed, 17 insertions(+), 74 deletions(-) diff --git a/challenge_13/c/karanchawla/challenge_13.c b/challenge_13/c/karanchawla/challenge_13.c index e401485e7..b130b0027 100644 --- a/challenge_13/c/karanchawla/challenge_13.c +++ b/challenge_13/c/karanchawla/challenge_13.c @@ -4,81 +4,17 @@ #include #include -// Dynamic Array Definition -////////////////////////////////////////////////////////////////////////////////// -typedef struct { - int *array; - size_t used; - size_t size; -} Array; - -void initArray(Array *a, size_t initialSize) -{ - a->array = (int *)malloc(initialSize * sizeof(int)); - a->used = 0; - a->size = initialSize; -} - -void insertArray(Array *a, int element) +int reverse(int x) { -// a->used is the number of used entries, because a->array[a->used++] updates a->used only *after* the array has been accessed. -// Therefore a->used can go up to a->size - if (a->used == a->size) + int ans = 0; + while(x != 0) { - a->size *= 2; - a->array = (int *)realloc(a->array, a->size * sizeof(int)); + ans = ans * 10; + ans = ans + x%10; + x = x/10; } - a->array[a->used++] = element; -} - -void freeArray(Array *a) -{ - free(a->array); - a->array = NULL; - a->used = a->size = 0; -} -/* -Array a; -int i; -initArray(&a, 5); // initially 5 elements -for (i = 0; i < 100; i++) -insertArray(&a, i); // automatically resizes as necessary -printf("%d\n", a.array[9]); // print 10th element -printf("%d\n", a.used); // print number of elements -freeArray(&a); -*/ -/////////////////////////////////////////////////////////////////////////////////// - -void isPalindrome(int num) -{ - Array a; - initArray(&a,1); - while(num) - { - insertArray(&a, num%10); - num /= 10; - } - - int size = a.used; - - int flag = 1; - for(int i=0;i Date: Wed, 18 Jan 2017 15:00:15 -0600 Subject: [PATCH 77/95] Update README.md --- challenge_13/c/karanchawla/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge_13/c/karanchawla/README.md b/challenge_13/c/karanchawla/README.md index 8ae239cf4..92d0d2c81 100644 --- a/challenge_13/c/karanchawla/README.md +++ b/challenge_13/c/karanchawla/README.md @@ -3,4 +3,4 @@ Karan Chawla Challenge 13 ``` -Implemented dynamic arrays and added each digit of the number, created an ```isPalindrome``` method to check for the Palindrome. The method returns ```true``` if the number is a palindrome, else it returns ```flase```. \ No newline at end of file +The code just reverses the input number and checks if it is the same as the original number. The method returns ```true``` if the number is a palindrome, else it returns ```flase```. From 686b8b3c3004da7ae36bf729c9748706da8853c8 Mon Sep 17 00:00:00 2001 From: JakeBash Date: Wed, 18 Jan 2017 17:25:21 -0500 Subject: [PATCH 78/95] Challenge 2 completed Completed Challenge #2 in the Java programming language --- challenge_2/Java/JakeBash/Challenge_2.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 challenge_2/Java/JakeBash/Challenge_2.java diff --git a/challenge_2/Java/JakeBash/Challenge_2.java b/challenge_2/Java/JakeBash/Challenge_2.java new file mode 100644 index 000000000..ffce465c4 --- /dev/null +++ b/challenge_2/Java/JakeBash/Challenge_2.java @@ -0,0 +1,62 @@ +import java.io.*; +import java.util.*; +import java.util.Scanner; + +/** + * This class holds the code needed to meet the requirements for Challenge 2 of + * the 2017 Year of Programming. + * + * @author Jake Bashaw + */ +public class Challenge_2 +{ + /** + * Prompts the user for input and displays the non-repeated string from the + * input + */ + public static void main(String[] args) + { + System.out.println("Please enter a series of space seperated characters"); + Scanner kb = new Scanner(System.in); + String[] input = kb.nextLine().split(" "); + System.out.println(singleNumber(input)); + } + + /** + * Finds the only non-repeated String in an array of Strings + * + * @param input The String array that is to be searched + */ + public static String singleNumber(String[] input) + { + HashMap inputMap = new HashMap<>(); + + for(String str : input) + { + if(inputMap.containsKey(str)) + { + int value = inputMap.get(str); + inputMap.remove(str); + inputMap.put(str, value+1); + } + else + { + inputMap.put(str, 1); + } + } + + for (Map.Entry entry : inputMap.entrySet()) + { + String key = entry.getKey(); + int value = entry.getValue(); + + if(value == 1) + { + return key; + } + } + + // If there are no non repeating elements + return "No non-repeating elements were in the array"; + } +} From 7261c0371a15df723d62bbcf4144a2c71940a0c4 Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Wed, 18 Jan 2017 17:26:48 -0500 Subject: [PATCH 79/95] Released challenge 14 --- .../python/slandau3/.vscode/settings.json | 5 ++ challenge_12/python/slandau3/compression.py | 33 +++++---- challenge_12/python/slandau3/tests.py | 9 ++- challenge_14/README.md | 25 +++++++ challenge_14/java/slandau3/src/Reverse.java | 68 +++++++++++++++++++ challenge_14/tests/test1 | 1 + challenge_14/tests/test2 | 1 + challenge_14/tests/test3 | 1 + challenge_14/tests/test4 | 1 + 9 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 challenge_12/python/slandau3/.vscode/settings.json create mode 100644 challenge_14/README.md create mode 100644 challenge_14/java/slandau3/src/Reverse.java create mode 100644 challenge_14/tests/test1 create mode 100644 challenge_14/tests/test2 create mode 100644 challenge_14/tests/test3 create mode 100644 challenge_14/tests/test4 diff --git a/challenge_12/python/slandau3/.vscode/settings.json b/challenge_12/python/slandau3/.vscode/settings.json new file mode 100644 index 000000000..9612230c7 --- /dev/null +++ b/challenge_12/python/slandau3/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "python.linting.pylintEnabled": true, + "python.pythonPath": "python3", + "python.formatting.provider": "autopep8" +} \ No newline at end of file diff --git a/challenge_12/python/slandau3/compression.py b/challenge_12/python/slandau3/compression.py index 4253498f9..c5e470bcf 100644 --- a/challenge_12/python/slandau3/compression.py +++ b/challenge_12/python/slandau3/compression.py @@ -9,28 +9,34 @@ def compress(string_to_compress: str) -> str: output = "" # The compressed string that will be outputted character = "" # character the string_to_compress at blank occurrences = 0 # the number of occurrences of this letter - for index, char in enumerate(string_to_compress): # goes through both the range and the characters at the same time - if char != character or index == len(string_to_compress)-1: # if we spot a different character, + # goes through both the range and the characters at the same time + for index, char in enumerate(string_to_compress): + # if we spot a different character, + if char != character or index == len(string_to_compress) - 1: # or are at the end of the string_to_compress # go here - if index == len(string_to_compress)-1 and character == char: # If we are at the end of + # If we are at the end of + if index == len(string_to_compress) - 1 and character == char: # the string_to_compress - # but the last character is the same, add to the occurrences of the character + # but the last character is the same, add to the occurrences of + # the character occurrences += 1 if occurrences > COMPRESSION_CUTOFF: - # If we have more than three occurrences, add the compress format to the output + # If we have more than three occurrences, add the compress + # format to the output output += character + '#' + str(occurrences) else: - # the next line puts 'occurrences' number of 'character' in the output + # the next line puts 'occurrences' number of 'character' in the + # output output += character * occurrences - if index == len(string_to_compress)-1 and character != char: + if index == len(string_to_compress) - 1 and character != char: # If we are at the end of the string_to_compress and the character # is not the same as the last. Top it off output += char - character = char # set char to character so we know the last character we looked at + character = char # set char to character so we know the last character we looked at occurrences = 1 else: @@ -41,15 +47,18 @@ def compress(string_to_compress: str) -> str: def decompress(string_to_uncompress: str) -> str: # Using regular expressions to parse the string_to_uncompress - matches = re.findall(r'(.#\d+)', string_to_uncompress) # Looking for [anything]#[at least one number] - decompressed = string_to_uncompress # decompressed is the new string that we will output - for match in matches: # Scan through the matches and uncompress each of them + # Looking for [anything]#[at least one number] + matches = re.findall(r'(.#\d+)', string_to_uncompress) + # decompressed is the new string that we will output + decompressed = string_to_uncompress + for match in matches: # Scan through the matches and uncompress each of them # match the character so we know what character we need to expand char = re.match(r'(.)#\d+', match) # Determine the number of times it occurred times = re.search(r'(\d+)', match) - replacement = char.group(1) * int(times.group(1)) # To get the matches specifically we need to access + # To get the matches specifically we need to access + replacement = char.group(1) * int(times.group(1)) # them at group 1 decompressed = decompressed.replace(match, replacement) diff --git a/challenge_12/python/slandau3/tests.py b/challenge_12/python/slandau3/tests.py index 5168ccf79..fc38db22b 100644 --- a/challenge_12/python/slandau3/tests.py +++ b/challenge_12/python/slandau3/tests.py @@ -4,6 +4,9 @@ from compression import compress, decompress class Test(unittest.TestCase): + """ + hello + """ def test1(self): """ @@ -17,7 +20,8 @@ def test2(self): An arbitrarily long string :return: """ - self.assertEqual(compress('abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj'), "abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj") + self.assertEqual(compress('abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj'), \ + "abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj") def test3(self): """ @@ -38,7 +42,8 @@ def test5(self): Decompress a fairly large string without too many compressions in it. :return: """ - self.assertEqual(decompress('abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj'), 'abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj') + self.assertEqual(decompress('abadbadsakdlfjieafnealfjiasfja#5nad#7kkkjj'), \ + 'abadbadsakdlfjieafnealfjiasfjaaaaanadddddddkkkjj') def test6(self): """ diff --git a/challenge_14/README.md b/challenge_14/README.md new file mode 100644 index 000000000..8de8eec6d --- /dev/null +++ b/challenge_14/README.md @@ -0,0 +1,25 @@ +Reversing a linked list +====== +Idea +---- +Everyone should be somewhat familiar with the concept of a linked list by now. Today, you're job is to create a linked list and reverse it. Your program needs to be able to take strings from standard input, which will be used as each nodes data attribute. The strings in standard input will be space separated. Nodes are to be created and connected for these strings one after another (newest node is appended to the end of the linked list). + +As for the "reverse" function. You need to implement a function to reverse the linked list. However, you may not touch the data on any of the nodes. The list must be reversed by manipulating the "next" attribute of each node. + +The program should run in O(N) time. + +You should have another function that will print the linked list (simply loop through it and print the data at each node). + +Testing +------ +In order to test the program, you may use the provided test files. Plug all strings from the test files into your program to create a node for each one. Print the list of nodes then reverse the list. After the list has been completely reversed output the list again (which should result in the reverse of what was previously printed). + +The test inputs are also listed below. + +1. r e d r u m + +2. p a r k + +3. b o o b y t r a p + +4. l i v e \ No newline at end of file diff --git a/challenge_14/java/slandau3/src/Reverse.java b/challenge_14/java/slandau3/src/Reverse.java new file mode 100644 index 000000000..19a4106d5 --- /dev/null +++ b/challenge_14/java/slandau3/src/Reverse.java @@ -0,0 +1,68 @@ +/** + * Created by slandau on 1/11/17. + */ +public class Reverse { + public Node root = null; + public int size = 0; + + private class Node { + public T data; + public Node next; + + public Node(T data) { + this.data = data; + } + } + + public void append(T data) { + if (size == 0) { + root = new Node(data); + } else { + Node temp = root; + while (temp.next != null) { + temp = temp.next; + } + temp.next = new Node(data); + } + size++; + } + + public void reverse() { + if (size == 1) { + // do nothing + } else { + Node prev = null; + Node cur = root; + Node next = root.next; + while (next != null) { + cur.next = prev; + prev = cur; + cur = next; + next = next.next; + } + cur.next = prev; + root = cur; + } + + } + + public void print() { + Node temp = root; + while (temp != null) { + System.out.println(temp.data); + temp = temp.next; + } + } + + + public static void main(String[] args) { + Reverse a = new Reverse<>(); + a.append(1); + a.append(2); + a.append(3); + a.print(); + a.reverse(); + a.print(); + } + +} diff --git a/challenge_14/tests/test1 b/challenge_14/tests/test1 new file mode 100644 index 000000000..1895c812a --- /dev/null +++ b/challenge_14/tests/test1 @@ -0,0 +1 @@ +r e d r u m diff --git a/challenge_14/tests/test2 b/challenge_14/tests/test2 new file mode 100644 index 000000000..e523bfa61 --- /dev/null +++ b/challenge_14/tests/test2 @@ -0,0 +1 @@ +p a r k diff --git a/challenge_14/tests/test3 b/challenge_14/tests/test3 new file mode 100644 index 000000000..73500607c --- /dev/null +++ b/challenge_14/tests/test3 @@ -0,0 +1 @@ +b o o b y t r a p diff --git a/challenge_14/tests/test4 b/challenge_14/tests/test4 new file mode 100644 index 000000000..c80403e12 --- /dev/null +++ b/challenge_14/tests/test4 @@ -0,0 +1 @@ +l i v e From 18e91430cb065539e8130b3f74ae78177d0517c4 Mon Sep 17 00:00:00 2001 From: Karan Chawla Date: Fri, 20 Jan 2017 11:49:05 -0600 Subject: [PATCH 80/95] [C] Challenge 14 (Unreviewed) (#431) [C] Challenge 14 (Reviewed) --- challenge_14/c/karanchawla/README.md | 6 ++ challenge_14/c/karanchawla/challenge_14.c | 88 +++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 challenge_14/c/karanchawla/README.md create mode 100644 challenge_14/c/karanchawla/challenge_14.c diff --git a/challenge_14/c/karanchawla/README.md b/challenge_14/c/karanchawla/README.md new file mode 100644 index 000000000..05ed6e77b --- /dev/null +++ b/challenge_14/c/karanchawla/README.md @@ -0,0 +1,6 @@ +``` +Karan Chawla +Challenge 14 +``` + +Approach: The aim here is to reverse a linked list. This is achieved by using three pointers - prev, current and next. Current moves along the linked list while the prev and next pointers are switched. Finally the head is set to the prev - completing the list reversal. \ No newline at end of file diff --git a/challenge_14/c/karanchawla/challenge_14.c b/challenge_14/c/karanchawla/challenge_14.c new file mode 100644 index 000000000..fd8604208 --- /dev/null +++ b/challenge_14/c/karanchawla/challenge_14.c @@ -0,0 +1,88 @@ +//Karan Chawla +//Challenge 14 + +#include +#include + +//Linked list node definition +typedef struct node +{ + char c; + struct node* next; +}Node; + + +//utility function to create a new node +Node* newNode(char c) +{ + Node* new_node = (Node*)malloc(sizeof(Node)); + new_node->c = c; + new_node->next = NULL; + + return new_node; +} + +//utility function to add a new node to the linked list +void push(Node** head_ref, char c) +{ + Node* new_node = newNode(c); + + new_node->next = *head_ref; + + *head_ref = new_node; +} + + +//function to reverse the linked list +//prev->curr->next +//changes prev to next and moves current along the linked list until NULL +void reverseLinkedList(Node** head_ref) +{ + if (*head_ref==NULL) + return; + + Node* prev = NULL; + Node* current = *head_ref; + Node* next; + while(current!=NULL) + { + next = current->next; + current->next = prev; + prev = current; + current = next; + } + *head_ref = prev; +} + +//utility function to print linked list +void printLinkedList(Node* head) +{ + while(head!=NULL) + { + printf("%c->", head->c); + head = head->next; + } + printf("NULL\n"); +} + +//driver program +int main(void) +{ + Node* head = NULL; + //create a linked list with chars from "murder" + push(&head,'r'); + push(&head,'e'); + push(&head,'d'); + push(&head,'r'); + push(&head,'u'); + push(&head,'m'); + + //print the linked list + printLinkedList(head); + //reverse the linked list + reverseLinkedList(&head); + //print the reversed linked list + printLinkedList(head); + + return 0; +} From 3f71adbac15e0eec0d9f042ec7bcb9c84d9bd778 Mon Sep 17 00:00:00 2001 From: AJ Schrier Date: Fri, 20 Jan 2017 09:50:01 -0800 Subject: [PATCH 81/95] [Python]Challenge_7(Unreviewed) (#432) [Python]Challenge_7(Reviewed) --- challenge_7/python/ajschrier/MissingNumber.py | 23 ++++ challenge_7/python/ajschrier/README.md | 23 ++++ .../python/ajschrier/Test_MissingNumber.py | 108 ++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 challenge_7/python/ajschrier/MissingNumber.py create mode 100644 challenge_7/python/ajschrier/README.md create mode 100644 challenge_7/python/ajschrier/Test_MissingNumber.py diff --git a/challenge_7/python/ajschrier/MissingNumber.py b/challenge_7/python/ajschrier/MissingNumber.py new file mode 100644 index 000000000..54552a704 --- /dev/null +++ b/challenge_7/python/ajschrier/MissingNumber.py @@ -0,0 +1,23 @@ +def builtInMethod(inputList): + for i in xrange(len(inputList)): + # Check if i is in list + if i not in inputList: + # Return number + return i + # Return 0 if none of the numbers meet the condition + return 0 + + +def sumMethod(inputList): + # find (n*n+1)/2 + fullSum = (len(inputList) * (len(inputList) + 1)) / 2 + # subtract sum of full range from supplied range + return fullSum - sum(inputList) + + +def main(): + pass + + +if __name__ == '__main__': + main() diff --git a/challenge_7/python/ajschrier/README.md b/challenge_7/python/ajschrier/README.md new file mode 100644 index 000000000..07327870b --- /dev/null +++ b/challenge_7/python/ajschrier/README.md @@ -0,0 +1,23 @@ +# Challenge 7 - Find the Missing Number + +*Python Version:* 2.7 + +In a list 0..N, find which digit is missing. + +# Functions + +## builtInMethod + +**Input:** List +**Output:** Integer + +Finds the integer 0 < x < N not present in list. The 'not in' syntax performs at O(N) according to [the Python Wiki](https://wiki.python.org/moin/TimeComplexity), so that is used to check the list for the value in the range. + +**UPDATE**: 'not in' syntax is O(N), but the fact that it's in another loop makes the solution O(N^2). Thanks erocs. + +## sumMethod + +**Input:** List +**Output:** Integer + +Uses the principle of sequential ranges (n*n+1)/2 to find the missing element. The sum of the input list is subtracted from the sum of the full range, exposing the missing element. \ No newline at end of file diff --git a/challenge_7/python/ajschrier/Test_MissingNumber.py b/challenge_7/python/ajschrier/Test_MissingNumber.py new file mode 100644 index 000000000..2b4681d3e --- /dev/null +++ b/challenge_7/python/ajschrier/Test_MissingNumber.py @@ -0,0 +1,108 @@ +import MissingNumber +import unittest + + +class BuiltInTests(unittest.TestCase): + """tests for builtInMethod""" + + def testMissing3(self): + self.assertEqual(MissingNumber. + builtInMethod([0, 1, 2, 4]), 3) + + def testMissing2(self): + self.assertEqual(MissingNumber. + builtInMethod([1, 3, 4, 0]), 2) + + def testNoMissingNumber(self): + self.assertEqual(MissingNumber. + builtInMethod([1, 2, 3]), 0) + + def testLongerList(self): + self.assertEqual(MissingNumber. + builtInMethod([0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24]), 7) + + def testEvenLongerRandomList(self): + self.assertEqual(MissingNumber. + builtInMethod([78, 53, 118, 99, 154, 5, 52, 184, + 73, 17, 92, 107, 34, 159, 101, 30, + 171, 95, 100, 54, 63, 169, 37, 45, + 174, 158, 57, 0, 89, 61, 71, 188, + 83, 18, 133, 149, 62, 151, 90, 3, + 141, 126, 165, 179, 103, 166, 68, + 177, 163, 190, 77, 55, 31, 187, 16, + 91, 47, 93, 146, 147, 74, 185, 135, + 102, 41, 125, 164, 12, 19, 168, 96, + 23, 86, 194, 9, 132, 104, 122, 24, + 144, 161, 117, 183, 196, 176, 155, + 108, 172, 120, 160, 182, 50, 75, 22, + 15, 49, 80, 127, 106, 20, 148, 139, + 38, 134, 67, 123, 56, 88, 40, 186, + 131, 76, 59, 21, 43, 4, 14, 115, + 162, 199, 48, 128, 81, 39, 11, 97, + 137, 153, 10, 65, 138, 114, 79, 6, + 195, 156, 180, 8, 28, 60, 192, 42, + 119, 64, 2, 200, 116, 129, 51, 178, + 191, 121, 82, 143, 26, 110, 33, 136, + 32, 175, 27, 150, 111, 105, 70, 157, + 44, 13, 46, 170, 58, 69, 198, 193, + 167, 25, 29, 181, 66, 72, 36, 87, 7, + 98, 130, 152, 94, 189, 1, 84, 109, + 113, 197, 145, 35, 124, 112, 173, + 140, 142]), 85) + + +class SumMethodTests(unittest.TestCase): + """tests for sumMethod""" + + def testMissing3(self): + self.assertEqual(MissingNumber. + sumMethod([0, 1, 2, 4]), 3) + + def testMissing2(self): + self.assertEqual(MissingNumber. + sumMethod([1, 3, 4, 0]), 2) + + def testNoMissingNumber(self): + self.assertEqual(MissingNumber. + sumMethod([1, 2, 3]), 0) + + def testLongerList(self): + self.assertEqual(MissingNumber. + sumMethod([0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24]), 7) + + def testEvenLongerRandomList(self): + self.assertEqual(MissingNumber. + sumMethod([78, 53, 118, 99, 154, 5, 52, 184, + 73, 17, 92, 107, 34, 159, 101, 30, + 171, 95, 100, 54, 63, 169, 37, 45, + 174, 158, 57, 0, 89, 61, 71, 188, + 83, 18, 133, 149, 62, 151, 90, 3, + 141, 126, 165, 179, 103, 166, 68, + 177, 163, 190, 77, 55, 31, 187, 16, + 91, 47, 93, 146, 147, 74, 185, 135, + 102, 41, 125, 164, 12, 19, 168, 96, + 23, 86, 194, 9, 132, 104, 122, 24, + 144, 161, 117, 183, 196, 176, 155, + 108, 172, 120, 160, 182, 50, 75, 22, + 15, 49, 80, 127, 106, 20, 148, 139, + 38, 134, 67, 123, 56, 88, 40, 186, + 131, 76, 59, 21, 43, 4, 14, 115, + 162, 199, 48, 128, 81, 39, 11, 97, + 137, 153, 10, 65, 138, 114, 79, 6, + 195, 156, 180, 8, 28, 60, 192, 42, + 119, 64, 2, 200, 116, 129, 51, 178, + 191, 121, 82, 143, 26, 110, 33, 136, + 32, 175, 27, 150, 111, 105, 70, 157, + 44, 13, 46, 170, 58, 69, 198, 193, + 167, 25, 29, 181, 66, 72, 36, 87, 7, + 98, 130, 152, 94, 189, 1, 84, 109, + 113, 197, 145, 35, 124, 112, 173, + 140, 142]), 85) + + +if __name__ == '__main__': + unittest.main() From bb45f0aed8cbfb8ccceee087c7845e49aa92d53d Mon Sep 17 00:00:00 2001 From: jfrancis2 Date: Fri, 20 Jan 2017 20:34:22 +0000 Subject: [PATCH 82/95] [C#] Challenge 0 (Unreviewed) (#440) --- challenge_0/csharp/jfrancis2/README.md | 14 ++++++++++++++ challenge_0/csharp/jfrancis2/src/hello.cs | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 challenge_0/csharp/jfrancis2/README.md create mode 100644 challenge_0/csharp/jfrancis2/src/hello.cs diff --git a/challenge_0/csharp/jfrancis2/README.md b/challenge_0/csharp/jfrancis2/README.md new file mode 100644 index 000000000..4abe81fb9 --- /dev/null +++ b/challenge_0/csharp/jfrancis2/README.md @@ -0,0 +1,14 @@ +# Challenge 0 - Hello World +###### C# + +### 1. Approach to Solving the problem + +Output text "Hello World" + +### 2. How to compile and run this code + +From the /src directory, use `csc.exe hello.cs` + +### 3. How this program works + +Read the text! Hi :) \ No newline at end of file diff --git a/challenge_0/csharp/jfrancis2/src/hello.cs b/challenge_0/csharp/jfrancis2/src/hello.cs new file mode 100644 index 000000000..1e51c6e68 --- /dev/null +++ b/challenge_0/csharp/jfrancis2/src/hello.cs @@ -0,0 +1,13 @@ +using System; +namespace HelloWorld +{ + class Hello + { + static void Main() + { + Console.WriteLine("Hello World!"); + Console.WriteLine("Press any key to exit."); + Console.ReadKey(); + } + } +} \ No newline at end of file From af73be102389ae4f894d27e9988f3e7002609556 Mon Sep 17 00:00:00 2001 From: jfrancis2 Date: Fri, 20 Jan 2017 23:00:34 +0000 Subject: [PATCH 83/95] Csharp Challenge 1 (#443) * [C#] Challenge 0 (Unreviewed) * [C#] Challenge 1 (Unreviewed) --- challenge_1/csharp/jfrancis2/README.md | 17 +++++++++++++++++ challenge_1/csharp/jfrancis2/src/program.cs | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 challenge_1/csharp/jfrancis2/README.md create mode 100644 challenge_1/csharp/jfrancis2/src/program.cs diff --git a/challenge_1/csharp/jfrancis2/README.md b/challenge_1/csharp/jfrancis2/README.md new file mode 100644 index 000000000..42938f45c --- /dev/null +++ b/challenge_1/csharp/jfrancis2/README.md @@ -0,0 +1,17 @@ +# Challenge 1 - Reverse a String +###### C# + +### 1. Approach to Solving the problem + +I had to work out how to get a string, then make it backwards. Turns out there are inbuilt functions for this. + +### 2. How to compile and run this code + +From the /src directory, use `csc.exe program.cs` + +### 3. How this program works + +Takes a string from the console input +Converts to a char array +Uses the 'System.Reverse' function to change the order of the characters +Displays the reversed string \ No newline at end of file diff --git a/challenge_1/csharp/jfrancis2/src/program.cs b/challenge_1/csharp/jfrancis2/src/program.cs new file mode 100644 index 000000000..aded9040e --- /dev/null +++ b/challenge_1/csharp/jfrancis2/src/program.cs @@ -0,0 +1,21 @@ +using System; +namespace YOP2017 +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Enter a string to reverse: "); + string input = Console.ReadLine(); + Console.WriteLine("Your string in reverse: " + Program.reverseString(input)); + Console.WriteLine("Press any key to exit.") + Console.ReadKey(true); + } + public static string reverseString(string input) + { + char[] arr = input.ToCharArray(); + Array.Reverse(arr); + return new string(arr); + } + } +} From f82cbc2a0edd7de2b415887157535cbb5bbd94cb Mon Sep 17 00:00:00 2001 From: dewie102 Date: Fri, 20 Jan 2017 18:01:06 -0800 Subject: [PATCH 84/95] Challenge 0 Just making sure everything is working and I am doing everything right. --- challenge_0/cpp/dewie102/README.md | 19 +++++++++++++++++++ challenge_0/cpp/dewie102/src/HelloWorld.cpp | 5 +++++ 2 files changed, 24 insertions(+) create mode 100644 challenge_0/cpp/dewie102/README.md create mode 100644 challenge_0/cpp/dewie102/src/HelloWorld.cpp diff --git a/challenge_0/cpp/dewie102/README.md b/challenge_0/cpp/dewie102/README.md new file mode 100644 index 000000000..4bce4019a --- /dev/null +++ b/challenge_0/cpp/dewie102/README.md @@ -0,0 +1,19 @@ +# Hello World +###### C++ 11 + +### 1. Approch to solving the probelm + +Pretty self explainitory, just getting the basics down and making sure everything is correct. + +### 2. How to compile and run this + +In Windows - I used the Visual Studio C++ compiler, move to the proper directory and run: + +``` +cl.exe src/HelloWorld.cpp +HelloWorld.exe +``` + +### 3. How this program works + +The program just outputs "Hello, World!" on the main output stream. diff --git a/challenge_0/cpp/dewie102/src/HelloWorld.cpp b/challenge_0/cpp/dewie102/src/HelloWorld.cpp new file mode 100644 index 000000000..93f87137f --- /dev/null +++ b/challenge_0/cpp/dewie102/src/HelloWorld.cpp @@ -0,0 +1,5 @@ +#include + +int main(int argv, char** argc) { + return 0; +} From 7c7bedbbc193fa654492109ceb414a3d3c0be850 Mon Sep 17 00:00:00 2001 From: dewie102 Date: Fri, 20 Jan 2017 18:02:15 -0800 Subject: [PATCH 85/95] Revert "Challenge 0" This reverts commit f82cbc2a0edd7de2b415887157535cbb5bbd94cb. --- challenge_0/cpp/dewie102/README.md | 19 ------------------- challenge_0/cpp/dewie102/src/HelloWorld.cpp | 5 ----- 2 files changed, 24 deletions(-) delete mode 100644 challenge_0/cpp/dewie102/README.md delete mode 100644 challenge_0/cpp/dewie102/src/HelloWorld.cpp diff --git a/challenge_0/cpp/dewie102/README.md b/challenge_0/cpp/dewie102/README.md deleted file mode 100644 index 4bce4019a..000000000 --- a/challenge_0/cpp/dewie102/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Hello World -###### C++ 11 - -### 1. Approch to solving the probelm - -Pretty self explainitory, just getting the basics down and making sure everything is correct. - -### 2. How to compile and run this - -In Windows - I used the Visual Studio C++ compiler, move to the proper directory and run: - -``` -cl.exe src/HelloWorld.cpp -HelloWorld.exe -``` - -### 3. How this program works - -The program just outputs "Hello, World!" on the main output stream. diff --git a/challenge_0/cpp/dewie102/src/HelloWorld.cpp b/challenge_0/cpp/dewie102/src/HelloWorld.cpp deleted file mode 100644 index 93f87137f..000000000 --- a/challenge_0/cpp/dewie102/src/HelloWorld.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int main(int argv, char** argc) { - return 0; -} From d823250b155b9a96643b58bc536c5f0f2a817348 Mon Sep 17 00:00:00 2001 From: dewie102 Date: Fri, 20 Jan 2017 18:02:54 -0800 Subject: [PATCH 86/95] Revert "Revert "Challenge 0"" This reverts commit 7c7bedbbc193fa654492109ceb414a3d3c0be850. --- challenge_0/cpp/dewie102/README.md | 19 +++++++++++++++++++ challenge_0/cpp/dewie102/src/HelloWorld.cpp | 5 +++++ 2 files changed, 24 insertions(+) create mode 100644 challenge_0/cpp/dewie102/README.md create mode 100644 challenge_0/cpp/dewie102/src/HelloWorld.cpp diff --git a/challenge_0/cpp/dewie102/README.md b/challenge_0/cpp/dewie102/README.md new file mode 100644 index 000000000..4bce4019a --- /dev/null +++ b/challenge_0/cpp/dewie102/README.md @@ -0,0 +1,19 @@ +# Hello World +###### C++ 11 + +### 1. Approch to solving the probelm + +Pretty self explainitory, just getting the basics down and making sure everything is correct. + +### 2. How to compile and run this + +In Windows - I used the Visual Studio C++ compiler, move to the proper directory and run: + +``` +cl.exe src/HelloWorld.cpp +HelloWorld.exe +``` + +### 3. How this program works + +The program just outputs "Hello, World!" on the main output stream. diff --git a/challenge_0/cpp/dewie102/src/HelloWorld.cpp b/challenge_0/cpp/dewie102/src/HelloWorld.cpp new file mode 100644 index 000000000..93f87137f --- /dev/null +++ b/challenge_0/cpp/dewie102/src/HelloWorld.cpp @@ -0,0 +1,5 @@ +#include + +int main(int argv, char** argc) { + return 0; +} From f4f640c4a55b0459ee1bd51d4ffcb030f6c558e5 Mon Sep 17 00:00:00 2001 From: dewie102 Date: Fri, 20 Jan 2017 18:05:19 -0800 Subject: [PATCH 87/95] [cpp] Challenge 0 (Unreviewed) --- challenge_0/cpp/dewie102/src/HelloWorld.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/challenge_0/cpp/dewie102/src/HelloWorld.cpp b/challenge_0/cpp/dewie102/src/HelloWorld.cpp index 93f87137f..4e707b830 100644 --- a/challenge_0/cpp/dewie102/src/HelloWorld.cpp +++ b/challenge_0/cpp/dewie102/src/HelloWorld.cpp @@ -1,5 +1,6 @@ #include int main(int argv, char** argc) { + std::cout << "Hello, World!" << std::endl; return 0; } From 0957a7bcdc00d11c072d2a657ae885a9429ef9f0 Mon Sep 17 00:00:00 2001 From: dewie102 Date: Fri, 20 Jan 2017 22:06:29 -0800 Subject: [PATCH 88/95] [cpp] Challenge 1 (Unreviewed) --- challenge_1/cpp/dewie102/README.md | 19 +++++++++++++++ .../cpp/dewie102/src/ReverseString.cpp | 24 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 challenge_1/cpp/dewie102/README.md create mode 100644 challenge_1/cpp/dewie102/src/ReverseString.cpp diff --git a/challenge_1/cpp/dewie102/README.md b/challenge_1/cpp/dewie102/README.md new file mode 100644 index 000000000..843740659 --- /dev/null +++ b/challenge_1/cpp/dewie102/README.md @@ -0,0 +1,19 @@ +# Reverse a String +###### C++ 11 + +### 1. Approch to solving the problem + +Iterate through the string to be reveresed starting from the end and add each those letter to another string that is output. + +### 2. How to compile and run this + +In Windows - I used the Visual Studio C++ compiler, move to the proper directory and run: + +``` +cl.exe /EHsc src/ReverseString.cpp +ReverseString.exe +``` + +### 3. How this program works + +I take an input string and iterate through it backwards taking each letter and adding it to the back of the output string. diff --git a/challenge_1/cpp/dewie102/src/ReverseString.cpp b/challenge_1/cpp/dewie102/src/ReverseString.cpp new file mode 100644 index 000000000..aa995a920 --- /dev/null +++ b/challenge_1/cpp/dewie102/src/ReverseString.cpp @@ -0,0 +1,24 @@ +#include +#include + +using namespace std; + +string ReverseString(string input) { + string output; + for(int i = input.length() - 1; i >= 0; --i) { + output.push_back(input[i]); + } + + return output; +} + +int main(int argc, char** argv) { + string input; + string output; + + cout << "Please enter a string you wish to reverse: "; + getline(cin, input); + output = ReverseString(input); + cout << "The reversed string is: " << output << endl; + return 0; +} From 6e0c5a35ed3c6c0d2d486d99b696bd20e0d01916 Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Sat, 21 Jan 2017 18:45:42 -0500 Subject: [PATCH 89/95] Releasing challenge 15 --- challenge_15/README.md | 13 ++ .../slandau3/src/TakingCandyFromABaby.java | 161 ++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 challenge_15/README.md create mode 100644 challenge_15/java/slandau3/src/TakingCandyFromABaby.java diff --git a/challenge_15/README.md b/challenge_15/README.md new file mode 100644 index 000000000..20621add6 --- /dev/null +++ b/challenge_15/README.md @@ -0,0 +1,13 @@ +Taking Candy From A Baby +====== +Idea +------ +Remember cracking open a pinata on someones birthday? When all your friends would swarm the candy that fell out and you would have to fight your way through it? I do. Lotta friendships were lost at those birthday parties... Nevertheless, your job today is to simulate kids stealing candy from each other. The way this assignment goes is as follows: There are three kids, Tom, Bob and Joe. They each have varying (or the same, it's not really important) amounts of candy. Tom becomes gready as well and steels from ... himself? + +Testing +------ +Crate a Circularly Linked List and append various values to it. For simplicity sake, these values should be ints. + +Call the function that will initialize the steeling. + +Print the remaining kid. \ No newline at end of file diff --git a/challenge_15/java/slandau3/src/TakingCandyFromABaby.java b/challenge_15/java/slandau3/src/TakingCandyFromABaby.java new file mode 100644 index 000000000..5c192a4c2 --- /dev/null +++ b/challenge_15/java/slandau3/src/TakingCandyFromABaby.java @@ -0,0 +1,161 @@ +/** + * Created by slandau on 1/12/17. + */ + +/** + * @author Steven Landau + * @description A circularly linked list with the a function that + * determines who the survivor is when the little fucks start stealing candy + * from each other. + */ +public class TakingCandyFromABaby { + private int size = 0; // The size of circularly LL + public Node root = null; // The root node of the LL + + /** + * The acutal node class which will hold the data + * and a reference to the next node. + */ + private class Node { + public Node next = null; + public T data = null; + + public Node(T data) { + this.data = data; + } + } + + // Increments size of the list + private void incrementSize() { + this.size++; + } + + // Decrement size of the list + private void decrementSize() { + this.size--; + } + + /** + * Appends a node to the last index of the list. + * @param data the data the new node will contain + * @return nothing + */ + public void append(T data) { + if (size == 0) { + this.root = new Node(data); + } else { + Node temp = this.root; + int cur = 1; // Begin at 1 since we have + // already checked the root node. + while (cur != size) { + temp = temp.next; + cur++; + } + temp.next = new Node(data); + temp.next.next = this.root; + } + incrementSize(); + } + + // Prints the entire circularly linked list + public void printList() { + if (this.size == 0) { + System.out.println(this.root.data); + } else { + Node temp = this.root.next; + System.out.println(this.root.data); + while (temp != this.root) { + System.out.println(temp.data); + temp = temp.next; + } + } + } + + /** + * Function to remove a node from the circularly linked list. + * @param data of the node + * @exception DataNotFoundException if the data has not been found in the linked List + * @return nothing + */ + public void removeNode(T data) { + if (this.root.data == data) { + // We need to redirect the pointers to the root in two places. + Node temp = root; + while (temp.next.data != data) { + temp = temp.next; + } + this.root = this.root.next; // Set root to the next node + temp.next = temp.next.next; // and set the node after the temp (the previous root) to + // the next next node. + decrementSize(); + } else { + + int moves = 1; // begin counting at 1 since we already checked the root + + Node temp = this.root; + while (moves <= this.size) { + if (temp.next.data == data) { + temp.next = temp.next.next; + decrementSize(); + return; + } + moves++; + temp = temp.next; + } + // If we got here, then the data is not in the list + throw new IndexOutOfBoundsException(data + " not found in the linked list"); + } + } + + /** + * Function to begin the fuckery. The list is destroyed in the process. + * This function will remove every second node. + * @exception NotEnoughKids if there are not enough kids to steal from. + * @return The data of the surviving fuck. + */ + public T beginTheft() { // this destroys the list + if (size == 1 || size == 0) { + // A child cannot steel from themself + throw new NotEnoughKids("Not enough kids to steal from :("); + } else { + int current = 1; // Begin at 1 because we are looking at the first kids + // If you wish to change this to 0 then you will need to do current % 1 below. + while(size > 1) { + // If we are at a second kid, steel from him and make him run away crying. + if (current % 2 == 0) { + removeNode(root.data); + } + root = root.next; // move on to the (new) next kid. + current++; + } + return root.data; + } + } + + public static void main(String[] args) { + TakingCandyFromABaby a = new TakingCandyFromABaby<>(); + a.append(1); + a.append(2); + a.append(3); + a.append(4); + //a.removeNode(1); + //a.removeNode(3); + //a.printList(); + System.out.println(a.beginTheft()); + } +} + +// Custom exception to be used when there are not enough kids to +// perform an action. +class NotEnoughKids extends RuntimeException { + public NotEnoughKids(String message) { + super(message); + } +} + +// Custom exception to be used when data given via a parameter, does not exist in the list. +class DataNotFoundException extends RuntimeException { + public DataNotFoundException(String message) { + super(message); + } +} \ No newline at end of file From 5ef3211c47a40afb6e661ef0527da2ed8dadb49f Mon Sep 17 00:00:00 2001 From: Steven Landau Date: Sat, 21 Jan 2017 18:48:20 -0500 Subject: [PATCH 90/95] Fixed the readme and added an example --- challenge_15/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/challenge_15/README.md b/challenge_15/README.md index 20621add6..9910357a8 100644 --- a/challenge_15/README.md +++ b/challenge_15/README.md @@ -2,7 +2,7 @@ Taking Candy From A Baby ====== Idea ------ -Remember cracking open a pinata on someones birthday? When all your friends would swarm the candy that fell out and you would have to fight your way through it? I do. Lotta friendships were lost at those birthday parties... Nevertheless, your job today is to simulate kids stealing candy from each other. The way this assignment goes is as follows: There are three kids, Tom, Bob and Joe. They each have varying (or the same, it's not really important) amounts of candy. Tom becomes gready as well and steels from ... himself? +Remember cracking open a pinata on someones birthday? When all your friends would swarm the candy that fell out and you would have to fight your way through it? I do. Lotta friendships were lost at those birthday parties... Nevertheless, your job today is to simulate kids stealing candy from each other. The way this assignment goes is as follows: There are three kids, Tom, Bob and Joe. They each have varying (or the same, it's not really important) amounts of candy. Tom becomes gready as well and steels from himself because he isn't very smart. Testing ------ @@ -10,4 +10,8 @@ Crate a Circularly Linked List and append various values to it. For simplicity s Call the function that will initialize the steeling. -Print the remaining kid. \ No newline at end of file +Print the remaining kid. + +Example +------ +Given an array: a b c d your function should return c. From baec2cfbcc97cbbe1109138aea409276ee10e0f3 Mon Sep 17 00:00:00 2001 From: Mateusz Mielczarek Date: Sun, 22 Jan 2017 09:33:32 +0100 Subject: [PATCH 91/95] [Python] Challenge 0 (Unreviewed) --- challenge_0/python/sysek/README.md | 11 +++++++++++ challenge_0/python/sysek/src/hello.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 challenge_0/python/sysek/README.md create mode 100644 challenge_0/python/sysek/src/hello.py diff --git a/challenge_0/python/sysek/README.md b/challenge_0/python/sysek/README.md new file mode 100644 index 000000000..4fba239d5 --- /dev/null +++ b/challenge_0/python/sysek/README.md @@ -0,0 +1,11 @@ +# Challenge 0 +###### Python 3.6 +### 1. Approch to solving the problem +First challenge is to print 'hello world' in language + +### 2. How to run this code? +``` +$ python3 src/hello.py +``` +### 3. How this program works? +Print 'hello world' on the screen diff --git a/challenge_0/python/sysek/src/hello.py b/challenge_0/python/sysek/src/hello.py new file mode 100644 index 000000000..0ab9637cd --- /dev/null +++ b/challenge_0/python/sysek/src/hello.py @@ -0,0 +1 @@ +print('hello world!') From bea79109715d68a3435ae585c88950fb01805850 Mon Sep 17 00:00:00 2001 From: AJ Schrier Date: Sun, 22 Jan 2017 16:43:11 -0800 Subject: [PATCH 92/95] [Python]Challenge_6(Reviewed) (#425) * Challenge_3 in Python * Challenge_3 in Python * Started challenge_4 * Challenge_4 in Python * Challenge_5 in Python * Challenge 6 in Python * Fixed loop to prevent missing 0 value * Added Python version number to README --- challenge_5/python/ajschrier/README.md | 2 + challenge_6/python/ajschrier/IntRange.py | 41 +++++++++++++++++++ challenge_6/python/ajschrier/IntRangeTests.py | 20 +++++++++ challenge_6/python/ajschrier/README.md | 16 ++++++++ 4 files changed, 79 insertions(+) create mode 100644 challenge_6/python/ajschrier/IntRange.py create mode 100644 challenge_6/python/ajschrier/IntRangeTests.py create mode 100644 challenge_6/python/ajschrier/README.md diff --git a/challenge_5/python/ajschrier/README.md b/challenge_5/python/ajschrier/README.md index ab397f0cb..248909e1b 100644 --- a/challenge_5/python/ajschrier/README.md +++ b/challenge_5/python/ajschrier/README.md @@ -1,5 +1,7 @@ # Challenge 5 - Find the Difference +*Python Version:* 2.7 + Counts all the characters in a string and finds the added letter ## Functions diff --git a/challenge_6/python/ajschrier/IntRange.py b/challenge_6/python/ajschrier/IntRange.py new file mode 100644 index 000000000..ef8aabd31 --- /dev/null +++ b/challenge_6/python/ajschrier/IntRange.py @@ -0,0 +1,41 @@ +ARROW = '->' + + +def outputRange(inputList): + # Helper Vars + outputList = [] + rangeStart = None + rangeEnd = None + + for i in inputList: + # Detect the beginning of the list + if rangeStart is None: + rangeStart = i + rangeEnd = i + # Check for invalid sequence + elif rangeEnd is not i-1: + # If vars are equal, no sequence is being terminated + if rangeStart is rangeEnd: + rangeStart, rangeEnd = i, i + # If they're not, add the terminated sequence to the list + # and continue + else: + outputList.append('{}{}{}'.format(rangeStart, ARROW, rangeEnd)) + rangeStart, rangeEnd = i, i + # If none of the above, continue the current sequence + else: + rangeEnd = i + + # Check to see if a sequence is in progress at the end of the loop + if rangeStart is not rangeEnd: + outputList.append('{}{}{}'.format(rangeStart, ARROW, rangeEnd)) + return outputList + + +def main(): + print outputRange([1, 2, 3, 4, 8, 9, 10, 12, 13, 14]) + print outputRange([1, 2, 3, 4, 5, 8, 9, 10]) + + +if __name__ == '__main__': + main() diff --git a/challenge_6/python/ajschrier/IntRangeTests.py b/challenge_6/python/ajschrier/IntRangeTests.py new file mode 100644 index 000000000..07f52f30f --- /dev/null +++ b/challenge_6/python/ajschrier/IntRangeTests.py @@ -0,0 +1,20 @@ +from IntRange import outputRange +import unittest + + +class outputRangeTests(unittest.TestCase): + """test outputRange Function""" + def test1(self): + self.assertEqual(outputRange([1, 2, 3, 4, 8, 9, 10, 12, 13, 14]), + ["1->4", "8->10", "12->14"]) + + def test2(self): + self.assertEqual(outputRange([1, 2, 3, 4, 5, 8, 9, 10]), + ["1->5", "8->10"]) + + def test3(self): + self.assertEqual(outputRange([]), + []) + +if __name__ == '__main__': + unittest.main() diff --git a/challenge_6/python/ajschrier/README.md b/challenge_6/python/ajschrier/README.md new file mode 100644 index 000000000..0dfd85c63 --- /dev/null +++ b/challenge_6/python/ajschrier/README.md @@ -0,0 +1,16 @@ +# Challenge 6 - Integer Range + +*Python Version:* 2.7 + +Finds ranges of integers from an ordered integer list. + +## Functions + +### outputRange + +**Input:** list(integer) +**Output:**list(string) + +Checks the list for sequences. + +Starts by maintaining the current sequence. If there is a continuation found, store the new end of the sequence. Add the sequence to the output list after continuation breaks, skipping cases where the current sequence is length 1. Return the list of sequences, or an empty list if no sequences exist. From c2021890f4100bf05d76a4b125b720194edea2e6 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 22 Jan 2017 17:53:00 -0700 Subject: [PATCH 93/95] [go] Challenge 0 (Unreviewed) (#438) --- challenge_0/go/tml/README.md | 13 +++++++++++++ challenge_0/go/tml/src/helloworld.go | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 challenge_0/go/tml/README.md create mode 100644 challenge_0/go/tml/src/helloworld.go diff --git a/challenge_0/go/tml/README.md b/challenge_0/go/tml/README.md new file mode 100644 index 000000000..489064504 --- /dev/null +++ b/challenge_0/go/tml/README.md @@ -0,0 +1,13 @@ +# Hello World - golang + +## Installing golang with Homebrew +`brew install go` + +## Running the program +`go run helloworld.go` + +## Expected result + +`$ go run helloworld.go` + +`Hello, world` \ No newline at end of file diff --git a/challenge_0/go/tml/src/helloworld.go b/challenge_0/go/tml/src/helloworld.go new file mode 100644 index 000000000..ca2b0e90a --- /dev/null +++ b/challenge_0/go/tml/src/helloworld.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, world") +} \ No newline at end of file From cdf2b9a1b2c94452633f55a11cb4c727ee96fc80 Mon Sep 17 00:00:00 2001 From: Shivam Shukla Date: Mon, 23 Jan 2017 06:24:11 +0530 Subject: [PATCH 94/95] [Go] Challenge 1 (#441) --- challenge_1/go/shivams/README.md | 5 +++++ challenge_1/go/shivams/reverse.go | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 challenge_1/go/shivams/README.md create mode 100644 challenge_1/go/shivams/reverse.go diff --git a/challenge_1/go/shivams/README.md b/challenge_1/go/shivams/README.md new file mode 100644 index 000000000..44b9cf4be --- /dev/null +++ b/challenge_1/go/shivams/README.md @@ -0,0 +1,5 @@ +``` +go run reverse.go +Enter the string +Get the reverse output +``` \ No newline at end of file diff --git a/challenge_1/go/shivams/reverse.go b/challenge_1/go/shivams/reverse.go new file mode 100644 index 000000000..803aaadb2 --- /dev/null +++ b/challenge_1/go/shivams/reverse.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + //"strings" +) + +func reverseString(str string) string { + var revStr string + for i := len(str) - 1; i >= 0; i-- { + revStr = revStr + string(str[i]) + } + return revStr + +} + +func main() { + var str string + fmt.Println("Enter the string to reverse: ") + fmt.Scanf("%s", &str) + fmt.Println(reverseString(str)) +} From e032a3f1b6e731c9beb929ed2a4016d5fee87917 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Sun, 22 Jan 2017 18:02:55 -0700 Subject: [PATCH 95/95] [go] Challenge 1 (Unreviewed) (#439) * [go] Challenge 1 (Unreviewed) * Clean up README.md - I didn't keep as good of notes as I had intended --- challenge_1/go/tml/README.md | 6 ++++++ challenge_1/go/tml/src/strrev.go | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 challenge_1/go/tml/README.md create mode 100644 challenge_1/go/tml/src/strrev.go diff --git a/challenge_1/go/tml/README.md b/challenge_1/go/tml/README.md new file mode 100644 index 000000000..01e824744 --- /dev/null +++ b/challenge_1/go/tml/README.md @@ -0,0 +1,6 @@ +# golang: Reverse a string + +## My thought process +I don't want to do it in bytes - I want to use the runes support in golang +Tried the unicode normalization package, didn't really seem to make anything easier +http://devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/ looks useful \ No newline at end of file diff --git a/challenge_1/go/tml/src/strrev.go b/challenge_1/go/tml/src/strrev.go new file mode 100644 index 000000000..b31fc4d91 --- /dev/null +++ b/challenge_1/go/tml/src/strrev.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "os" + "bufio" +) + +func strrev(s string) string { + r := []rune(s) + rs := []rune{} + for i := len(r)-1; i>=0; i-- { + rs = append(rs, r[i]) + } + return string(rs) +} + +func main() { + scanner := bufio.NewScanner(os.Stdin) + for scanner.Scan() { + fmt.Println(strrev(scanner.Text())) + } +} \ No newline at end of file