Runtime Error for case 302


  • 0
    F

    Hi below code generate runtime error, but pass on the test case locally in the debugger...

    Submission Result: Runtime Error

    Last executed input:
    [302]

    	static bool CompFunc(int a, int b)
    	{
    		return a < b || a == b * 10;
    	}
    	
    	string largestNumber(vector<int>& nums) 
    	{
    		sort(nums.begin(), nums.end(), CompFunc);
    		string result;
    		for (int val : nums)
    		{
    			if (result.size() == 0 && val == 0) { continue; }
    			result += to_string(val);
    		}
    		return result;
    	}

Log in to reply
 

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