One line Java8 code that will surprise the Interviewer

  • 0
    1. It is the XOR operation.
    2. We combine Java 8 lambda expression and stream operation.
    public int singleNumber(int[] nums) {
            return, (x, y)->x ^y);

Log in to reply

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