2 Sum

From InterviewBit: Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, where index1 < index2. Please note that your returned answers (both index1 and index2 ) are not zero-based. Put both these numbers in order in anLanjutkan membaca “2 Sum”

Sudoku Solver

From InterviewBit: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character ‘.’ You may assume that there will be only one unique solution. A sudoku puzzle, and its solution numbers marked in red.Example :For the above given diagrams, the corresponding input to your program will be[[53..7….], [6..195…],Lanjutkan membaca “Sudoku Solver”

NQueens

From InterviewBit The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle.Each solution contains a distinct board configuration of the n-queens’ placement, where ‘Q’ and ‘.’both indicate a queen and an empty space respectively.ForLanjutkan membaca “NQueens”