O(0) Solution, not sure if it should allowed due to changing node contents (not against the rules though)

  • 0

    I am not sure this should be allowed to work since a value of Integer.MIN_VALUE would break it, but it does work in O(0) space.

        	while(head != null){
        		if(head.val == Integer.MIN_VALUE){
        			return true;
        			head.val = Integer.MIN_VALUE;
        		head = head.next;
        	return false;

Log in to reply

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