摘要:
Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form 阅读全文
摘要:
阅读全文
摘要:
Problem: Given a string, find the lexicographical minimum string keeping the order of alphabets same as the original string.For example: Solution: Thi 阅读全文
摘要:
Given an integer array ‘arr[]’ of size n, find sum of all sub-arrays of given array. Examples: If we take a close look then we observe a pattern. Let 阅读全文
摘要:
This solution is just a java version derived from this post. At first, lets look at the edge cases - Now the main algorithm works in following steps - 阅读全文
摘要:
We can also do it without modifying the input by using a variable prev to hold the a[i-1]; if we have to lower a[i] to match a[i-1] instead of raising 阅读全文
摘要:
Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9]. Please optimize your algori 阅读全文
摘要:
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm should run i... 阅读全文
摘要:
题目给了我们两个数组,一个是进程的数组,还有一个是进程数组中的每个进程的父进程组成的数组。题目中说结束了某一个进程,其所有的子进程都需要结束,由于一个进程可能有多个子进程,所以我们首先要理清父子进程的关系。所以我们使用一个哈希表,建立进程和其所有子进程之间的映射,然后我们首先把要结束的进程放入一个队 阅读全文
摘要:
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文