New answers tagged

1 vote

Delete consecutive characters and add zeros at the end with a restriction

Have a write index. Then go through the array, identify and measure each streak of equal characters. Streaks shorter than 3 get written. At the end, write zeros at the remaining indices. Python ...
user avatar
1 vote

Delete consecutive characters and add zeros at the end with a restriction

While waiting for your updated post that includes your solution, I have posted mine: Solution A substring is deletable if all its characters will be deleted based on your requirement. This substring ...
user avatar
  • 1,257
1 vote

Is it faster to use Counting Sort to lexicographically sort characters in a word in Python?

Asymptotically, it doesn't matter if you have very long or short words, counting sort would take more space and time if the range in which those words lie is very large, since you will have to store ...
user avatar
  • 330
2 votes

Hash / Compression algorithm to shorten text?

If you insist that it be reservible, what you want is data compression. Unfortunately in practice it is unlikely that the result will be short enough to be useful. At that point I recommend you buy ...
user avatar
  • 140k

Top 50 recent answers are included