Ad
  • Default User Avatar

    Because the second j starts from i+1 so it will never be equal to i and it skips unnecessary steps.
    If your loop has j=0 replace it with j=i+1