This is my code, used 22ms , I don't know how to improve it , could you give some advice?Thanks !

  • 2
    int singleNumber(int A[], int n) {
        return A[0];

  • 0

    Try to use an external variable instead of A[0]. My solution runs in 6ms when using an external variable

  • 0

    Every loop you need to get a[0], if the array is too big, larger than the system pages for example, it will cause system interrupts.

Log in to reply

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