Posts

See a problem in else if statement

Dangling else problem

Image
Hello, This problem comes when we use else if statement and do some mistake more describe is given below......... Dangling else problem: One of the major problem with nested if is dangling else problem. The problem arises when both outer if statement inner if statement might pair with common else statement. Thus the compiler is not able to judge to pair the else with which statement. The solution to this problem is given by the compiler that it pairs else with the recent if thus sometimes giving wrong result.                                           Hence the programmer should put early bracket wherever required. This post is may very short because my only aim was to describe this problem. Thank you, Keep supporting............. 

Permutations of Strings hackerrank solution in C || Permutations of Strings

  Permutations of Strings Strings are usually ordered in lexicographical order. That means they are ordered by comparing their leftmost different characters. For example,   because  . Also   because  . If one string is an exact prefix of the other it is lexicographically smaller, e.g.,  . Given an array of strings sorted in lexicographical order, print all of its permutations in strict lexicographical order. If two permutations look the same, only print one of them. See the 'note' below for an example. Complete the function  next_permutation  which generates the permutations in the described order. For example,  . The six permutations in correct order are: ab bc cd ab cd bc bc ab cd bc cd ab cd ab bc cd bc ab Note:  There may be two or more of the same string as elements of  . For example,  . Only one instance of a permutation where all elements match should be printed. In other words, if  , then print either   or   but not both. A three element array having t