Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 24
    \$\begingroup\$ A variation on this trick I ran into today: -~-x saves one byte vs. (1-x). \$\endgroup\$ Commented Jul 15, 2015 at 11:34
  • 11
    \$\begingroup\$ Another useful application is that a+b+1 can be more concisely written as a-~b. \$\endgroup\$ Commented Jan 22, 2017 at 11:51
  • 5
    \$\begingroup\$ And n-i-1 is just n+~i. \$\endgroup\$ Commented Jun 9, 2019 at 22:23