⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’

Excalidraw Data

Text Elements

Input nums = [-1,0,1,2,-1,-4]

Output: [[-1,-1,2],[-1,0,1]]

b

c

a

  • Two loops
  • sort array to avoid duplicates
  • Use a as part of the outer index
  • b and c will decrease or increase based on sum
  • once b and c have crossed we increase a
  • and reset b and c and do the same process