File: root - text - article - 2020 - 01 - no-adjacent-repeating-characters.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 439 Views, 22956 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 439 Views, 22956 Search Bots | 57 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by LinkedIn:
Given a string, rearrange the string so that no character next to each other are the same. If no such arrangement is possible, then return None.
Example:
Input: abbccc
Output: cbcbca
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 439 Views, 22956 Search Bots | 57 Words Given a string, rearrange the string so that no character next to each other are the same. If no such arrangement is possible, then return None.
Example:
Input: abbccc
Output: cbcbca
def rearrangeString(s):
# Fill this in.
print rearrangeString('abbccc')
# cbcabc
Related Articles
- Daily Interview Problem: Merge Overlapping Intervals
- Find the non-duplicate number
- Most Frequent Subtree Sum
- How to Play WAV music under DOS?
- Daily Interview Problem: Longest Substring With K Distinct Characters
- Daily Interview Question: Word Search
- Daily Interview Problem: Reverse Words in a String
- Algorithm Interview Question: Nth Fibonacci Number
- Maximum In A Stack
- [Daily Problem] Course Prerequisites
©2006~2024 SteakOverCooked - 0.00942 Seconds(s) - 1963.288 KB/s - 37 Online Memory: 492.09 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !