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 | 456 Views, 24072 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 456 Views, 24072 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 | 456 Views, 24072 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
- Kaprekar
- Sort a Partially Sorted List
- Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
- Floor and Ceiling of a Binary Search Tree
- Batch Programming in XP
- Daily Interview Problem: Look and Say Sequence
- Top K Frequent words
- Daily Interview Problem: Sort Colors
- Daily Interview Problem: Group Words that are Anagrams
- A trick for getting good at coding interviews FASTER
©2006~2024 SteakOverCooked - 0.0076 Seconds(s) - 2529.933 KB/s - 15 Online Memory: 493.26 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 !