Why my C# solution returns a wrong answer?


  • 0
    S

    Hi, I've written a C# solution with LINQ, it works on my IDE, but got a wrong answer on the Leetcode.
    After checked many times, still, I can't find out what's going wrong. Is there anyone can help me?

        public void MoveZeroes(int[] nums) {
            
            nums = nums.Where(x => x != 0).ToArray().Concat(nums.Where(x => x == 0).ToArray()).ToArray();
            
        }
    

    alt text


  • 0
    D
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.