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 | 440 Views, 22987 Search Bots | 57 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 440 Views, 22987 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 | 440 Views, 22987 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: Given two arrays, write a function to compute their intersection.
- Daily Interview Problem: Reconstrunct Binary Tree from Preorder and Inorder Traversals
- Algorithm Interview Question: Nth Fibonacci Number
- Algorithm Interview: Maximum Path Sum in Binary Tree
- Algorithm Interview: Lowest Common Ancestor of 2 Nodes in Binary Tree
- Algorithm Interview: Subarray With Target Sum
- Daily Interview Question: Word Search
- Daily Interview Problem: Group Words that are Anagrams
- Fibonacci coding
- Daily Interview Problem: Count Number of Unival Subtrees
©2006~2024 SteakOverCooked - 0.00779 Seconds(s) - 2372.87 KB/s - 31 Online Memory: 492.52 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 !