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 | 217 Views, 19896 Search Bots | 57 Words
| Browse | Archive
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 217 Views, 19896 Search Bots | 57 Words
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
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 | 217 Views, 19896 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
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Related Articles
- Daily Interview Puzzle: Ways to Traverse a Grid
- Algorithm Interview: No Adjacent Repeating Characters
- Staying on a Chess Board
- Daily Interview Problem: Contiguous Subarray with Maximum Sum
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Floor and Ceiling of a Binary Search Tree
- Daily Interview Problem: Reverse Words in a String
- Daily Interview Problem: Count Number of Unival Subtrees
- Daily Interview Problem: Merge Overlapping Intervals
- Reverse a Linked List
©2006~2024 SteakOverCooked - 0.01429 Seconds(s) - 3736.062 KB/s - 10 Online
Memory: 531.91 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" />
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !