Labview Core 1
Labview Core 1
You are to output two string arrays i.e. Missing String Array and Repeating String Array.
4. Sudoku Solver:
Given a partially filled 9×9 2D array ‘grid [9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells
so that every row, column, and sub grid of size 3×3 contains exactly one instance of the digits from 1 to
9.
5. Surrounded Regions:
You are given an `m x n` array called `board` containing the letters 'X' and 'O'. Your goal is to identify
and capture regions of 'O' that are surrounded by 'X'.
- Connection: Cells are connected if they are next to each other horizontally or vertically.
- Region: A region is made up of connected 'O' cells.
- Surround: A region is surrounded if it is entirely enclosed by 'X' cells, with none of the 'O' cells
touching the edge of the board.
To capture a surrounded region, change all 'O's in that region to 'X's in the`board`.
6. Word Search:
Given an `m x n` board of characters and a list of strings `words`, return all the words that can be
found on the board.
Each word must be formed by letters from sequentially adjacent cells, where adjacent cells are next to
each other either horizontally or vertically. A cell cannot be used more than once in forming a word.
Example:
You are given an array of integers numbers, there is a sliding window of size k which is moving from the
very left of the array to the very right. You can only see the k numbers in the window. Each time the
sliding window moves right by one position.
Return the max sliding window.
Example 1:
Output: [3,3,5,5,6,7]
Explanation:
8. Spiral Matrix:
Example 1:
Output: [1,2,3,6,9,8,7,4,5]
Example 2:
Output: [1,2,3,4,8,12,11,10,9,5,6,7]
9. Game of Life:
According to Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton
devised by the British mathematician John Horton Conway in 1970."
The board is made up of an m x n grid of cells, where each cell has an initial state: live (represented by
a 1) or dead (represented by a 0).
Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four rules
(taken from the above Wikipedia article):
1. Any live cell with fewer than two live neighbors dies as if caused by under-population.
2. Any live cell with two or three live neighbors lives on to the next generation.
3. Any live cell with more than three live neighbors dies, as if by over-population.
4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
The next state is created by applying the above rules simultaneously to every cell in the current state,
where births and deaths occur simultaneously. Given the current state of the m x n grid board,
return the next state.
Example 1:
Example 2:
Example 1:
Input: stones = [0,1,3,5,6,8,12,17]
Output: true
Explanation: The frog can jump to the last stone by jumping 1 unit to the 2nd stone, then 2 units to the
3rd stone, then 2 units to the 4th stone, then 3 units to the 6th stone, 4 units to the 7th stone, and 5
units to the 8th stone.
Example 2:
Input: stones = [0,1,2,3,4,8,9,11]
Output: false
Explanation: There is no way to jump to the last stone as the gap between the 5th and 6th stone is too
large.
Example 2:
Input: nums = [3,1,4,2]
Output: true
Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
Example 3:
Input: nums = [-1,3,2,0]
Output: true
Explanation: There are three 132 patterns in the sequence: [-1, 3, 2], [-1, 3, 0] and [-1, 2, 0].
12. Tic-Tac-Toe Game:
Your task is to develop a simple Tic-Tac-Toe game. The game should meet the following
requirements:
a. Board Setup: Create a 3x3 grid where two players, X and O, can take turns to mark their
chosen cells.
b. Player Turns: Players should alternate turns, starting with Player X. Each player can choose
an empty cell on the grid to place their mark.
c. Winning Condition: The game is won when a player successfully places three of their marks
in a row, column, or diagonal.
d. Draw Condition: The game ends in a draw if all cells are filled and no player has achieved
three in a row.
e. User Interface: Display the board after each move, showing the current state of the game.
f. Input Validation: Ensure that players can only choose valid, empty cells on their turn.
g. Game Reset: Provide an option to reset the game and play again after a win or draw.