マツシタのお勉強

Array

Use a single array to implement three stacks

Problem Describe how you could use a single array to implement three stacks. We can divide the array in three equal parts. So we use the array like this. For stack 1, we will use [0, n/3) For stack 2, we will use [n/3, 2n/3) For stack 3, w…

Determine if a string has all unique characters

Problem Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures. How to solve Character can be transformed into integer. So, by using array its size is 256(ASCII), we can…