DEV Community

Mukilan Palanichamy
Mukilan Palanichamy

Posted on

My journey in competitive programming

1. Maximum Length of a Concatenated String with Unique Characters:

Given a list of strings, find all possible concatenations of these strings such that the final concatenated string has no duplicate characters. Return the maximum length of such a concatenated string.

Important Points:

  1. A string is valid only if it does not have any duplicate characters.

  2. The concatenation of the strings should also not create any duplicate characters.

  3. Backtracking can be applied to try all the permutations of strings.

Image description

2. N-Queens:

Place n queens on an n x n chessboard such that no two queens threaten each other. A queen can attack another if they are in the same row, column, or diagonal. Return all possible solutions, where each solution represents the board configuration.

Important Points:

  1. A queen threatens positions in its row, column, and both diagonals.

  2. Backtracking is used in arranging the queens row by row so that no two conflict with each other.

  3. The board is a list of strings where 'Q' is the queen and '.' the empty cell.

Image description

Top comments (0)