The 3rd testcase says it has the expected output of [-1] which makes no sense. When I press 'Use Testcase' and run it, it passes the testcase and says the expected output is [1, 2]. However, when i ...
When running the problem tests, I noticed that the same input appears in two different test cases but with two different expected outputs. The input nums and k are identical in both test cases, but ...
public static void main(String[] args) { int[] nums = {3, 3, 1, 0, 1, 3, 1, 3, 1}; System.out.println(majorityElement(nums)); } private static int majorityElement(int ...
FILE: An Afghan refugee woman sleeps in a bus at the Greek-Macedonian border, in Idomeni, 5 December 2015 Putin makes new claim on Ukraine after talks with Trump Prince and Princess of Wales move home ...
Then, what should be the expected output? Is it [1,2] or [1,2,3]? When I added it to the test case and executed, the expected output was [1,2]. It would be great if this case were included as an ...
This is my custom testcase and it's giving wrong expected answer then what the actual answer might be. Since we have to change two elements and then find the minimum possible score, thus, changing the ...
Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the ...
At first, I was decrementing the candidate counters alternately starting with the first candidate, then the second, and so on. My solution failed some test cases with that logic. Then, I switched the ...