2017-01-17から1日間の記事一覧
Problem Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3. If the string would not become smaller than the original string, your method…
Problem Write a method to replace all space in a string with '%2d'. You may assume that the string has sufficient space at the end of the string to hold the additional character, and that you are given the true length of the string. [examp…
Problem Given two strings, write a method to decide if one is a permutation of the other. How to Solve In oder to count of the number that how many times each characters appeared, I use array like HashMap. In case the given strings is ASCI…
How to Implement By swapping the head of the string character and the tail of one, I can reverse a string
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…
What's "Ring Buffer" Ring Buffer is basically like Queue. The difference between Ring Buffer and normal Queue is that Ring Buffer is circular data structure. So, if tail and head index reach the index of max size, they are reseted zero. Th…