Skip to main content
deleted 1 character in body
Source Link

Wolfram Language (Mathematica), 53 46 bytes

Tr[1^{0}~Union~Accumulate@Sign@Differences@#]&

Try it online!

Thanks to J42161217@J42161217 for pointing out usingthat Tr[1^list] as anis a 1-character-shorter alternative to Length@list.

Wolfram Language (Mathematica), 53 46 bytes

Tr[1^{0}~Union~Accumulate@Sign@Differences@#]&

Try it online!

Thanks to J42161217 for pointing out using Tr[1^list] as an 1-character-shorter alternative to Length@list.

Wolfram Language (Mathematica), 53 46 bytes

Tr[1^{0}~Union~Accumulate@Sign@Differences@#]&

Try it online!

Thanks to @J42161217 for pointing out that Tr[1^list] is a 1-character-shorter alternative to Length@list.

added 112 characters in body
Source Link

Wolfram Language (Mathematica), 5353 46 bytes

Length@Union@Append[Accumulate@Sign@Differences@#,0]&Tr[1^{0}~Union~Accumulate@Sign@Differences@#]&

Try it online!Try it online!

Thanks to J42161217 for pointing out using Tr[1^list] as an 1-character-shorter alternative to Length@list.

Wolfram Language (Mathematica), 53 bytes

Length@Union@Append[Accumulate@Sign@Differences@#,0]&

Try it online!

Wolfram Language (Mathematica), 53 46 bytes

Tr[1^{0}~Union~Accumulate@Sign@Differences@#]&

Try it online!

Thanks to J42161217 for pointing out using Tr[1^list] as an 1-character-shorter alternative to Length@list.

Source Link

Wolfram Language (Mathematica), 53 bytes

Length@Union@Append[Accumulate@Sign@Differences@#,0]&

Try it online!