Distribute Candy: Invalid test

My solution failed for following input because ranks are equal…this is unfair because question doesn’t say that ranks can be equal.

[-499, -497, -495, -494, -494, -494, -491, -490, -489, -477, -476, -475, -474, -471, -467, -467, -465, -465, -448, -446, -443, -442, -440, -435, -431, -431, -421, -419, -419, -418, -417, -414, -409, -409, -405, -404, -401, -401, -400, -400, -398, -396, -392, -390, -387, -387, -386, -386, -385, -382, -381, -380, -371, -371, -369, -368, -365, -363, -360, -359, -353, -352, -352, -352, -347, -345, -344, -340, -338, -337, -337, -337, -333, -332, -329, -326, -324, -317, -314, -311, -309, -308, -307, -306, -304, -304, -300, -297, -296, -293, -291, -288, -288, -285, -285, -282, -282, -280, -279, -276, -275, -273, -271, -269, -262, -261, -261, -259, -257, -255, -249, -248, -247, -247, -246, -245, -233, -228, -225, -224, -223, -219, -219, -215, -212, -211, -210, -207, -206, -206, -203, -202, -202, -201, -197, -197, -196, -190, -189, -185, -185, -184, -184, -183, -182, -181, -180, -180, -179, -176, -172, -166, -164, -164, -161, -157, -157, -153, -147, -147, -147, -144, -140, -140, -137, -136, -134, -133, -126, -122, -120, -119, -115, -104, -104, -100, -99, -96, -91, -91, -89, -87, -85, -83, -75, -74, -74, -73, -69, -63, -62, -62, -61, -56, -41, -39, -38, -37, -33, -33, -31, -29, -26, -24, -23, -20, -20, -20, -18, -18, -16, -15, -12, -9, -8, -8, -3, -2, -1, 1, 7, 8, 9, 10, 12, 13, 16, 16, 17, 20, 23, 24, 33, 36, 37, 39, 40, 42, 44, 44, 52, 54, 58, 58, 66, 76, 76, 77, 80, 81, 83, 89, 91, 92, 93, 94, 94, 98, 100, 101, 104, 109, 110, 112, 114, 115, 122, 123, 125, 126, 127, 127, 128, 131, 132, 138, 141, 146, 148, 150, 152, 155, 156, 156, 160, 161, 163, 164, 167, 168, 170, 170, 171, 172, 175, 179, 179, 183, 183, 183, 184, 186, 187, 188, 189, 190, 190, 191, 191, 195, 197, 197, 201, 203, 204, 204, 204, 208, 209, 213, 216, 218, 218, 219, 220, 222, 223, 225, 227, 227, 234, 234, 238, 241, 253, 254, 254, 255, 258, 259, 261, 263, 264, 265, 267, 270, 273, 275, 279, 282, 283, 284, 286, 288, 297, 304, 307, 308, 312, 313, 313, 318, 319, 319, 321, 323, 323, 326, 326, 328, 328, 328, 328, 329, 332, 337, 338, 341, 345, 346, 351, 356, 359, 361, 364, 366, 367, 369, 372, 372, 373, 375, 377, 380, 380, 381, 383, 385, 385, 386, 387, 388, 389, 389, 390, 390, 396, 398, 399, 401, 402, 405, 408, 408, 409, 411, 415, 418, 421, 422, 423, 426, 429, 430, 430, 430, 432, 438, 438, 440, 441, 442, 447, 452, 452, 453, 457, 464, 465, 465, 466, 473, 473, 474, 475, 475, 479, 480, 487, 490, 491, 492, 494, 495, 495, 496, 500]

Click here to start solving coding interview questions