darrellp

Weak Characters

Nov 6th, 2021 (edited)
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. public int NumberOfWeakCharacters(int[][] properties)
  2. {
  3.     var count = 0;
  4.    
  5.     for (var i = 0; i < properties.Length - 1; i++)
  6.     {
  7.         for (var j = i + 1; j < properties.Length; j++)
  8.         {
  9.             if ((properties[i][0] < properties[j][0] &&
  10.                 properties[i][1] < properties[j][1]) ||
  11.                 (properties[i][0] > properties[j][0] &&
  12.                 properties[i][1] > properties[j][1]))
  13.             {
  14.                 count++;
  15.             }
  16.         }
  17.     }
  18.     return count;
  19. }
  20.  
Add Comment
Please, Sign In to add comment