Company: Flipkart Hirepro

Difficulty: medium

Problem Statement

Akash has recently bought a puzzle book. Each page in the book has a word puzzle in which a grid of letters from the English alphabet (uppercase or lowercase) or digits between 0 and 9 is given. Akash has to figure out the number of occurrences of a particular word in the given grid. The grid is always a square , and the word can be present in any direction in the grid, i.e. left to right, right to left, top to bottom, bottom to top, and the four diagonal directions — eight directions in total. Palindrome words (which read the same as the original word from the reverse direction too), if present in the grid, will be counted twice . Write a program to help Akash. Matching is case sensitive : A and a are different characters. Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the output and test cases will fail. Input Format The first line of input has N , which is the number of rows/columns in th

More Flipkart Hirepro OA questionsInterview experiences