My one line Java solution (Using Java 8 Functional Programming)


  • 0
    B
    public class Solution {
        public int singleNumber(int[] nums) {
            return Arrays.stream(nums).reduce((left, right) -> left ^ right).getAsInt();
        }
    }
    

Log in to reply
 

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