akshitagit / akshitagit/JAVA

MATRIX SEARCH

Open
#61 6 comments 0 reactions 0 assignees View on GitHub
algorithm enhancement good first issue Hacktoberfest hacktoberfest2020
Dominant language
Java
Stars
101
Forks
131
PR merge metrics
No merged PRs in 30d

Description

STAR THIS REPO!

Given an n x m matrix, where every row and column is sorted in increasing order, and a number x . Find if element x is present in the matrix or not.

Input Format

First line consists of two space separated integers N and M, denoting the number of element in a row and column respectively. Second line of each test case consists of N*M space separated integers denoting the elements in the matrix in row major order. Third line of each test case contains a single integer x, the element to be searched.
Constraints

1 <= N,M <= 30 0 <= A[i] <= 100000

Output Format

Print 1 if the element is present in the matrix, else 0.

Sample Input

3 3
3 30 38
44 52 54
57 60 69

62

Sample Output

0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.