Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1 Propamining Lenguses longrightarrow Jeva 8 You are given an array S consisting of N strings. Every string is of the same length M

Task 1
Propamining Lenguses longrightarrow
Jeva 8
You are given an array S consisting of N strings. Every string is of the same length M. Your task is to find a palr of strings in array S, such that here exists a position in which both of the strings have the same lette oth the index in array S and the posittons in the strings are number is zero. (Pdt. Whave the same letter "b' in position 1. On the other hand or strin. "abc' and "bea' there does not exist a position in whit. they have the se veletter.
Write a inctions
cla:
Solution {public int[] solution
ring[] S): }
that, given a zero-indexed arroy S of N string streturns an arey describing a palr of stinges from 8 which share a common letter at some index. If there is no such paits the function should retum an empty array. If there is more than one cerrect answet the funetlon can retum any of them.
The result should be represented as an arroy containing three integers. The first two integers are the indexes in S of the strings belonging to the pair. The third integer is the postition of the common letter.
For S={'abc", "bea", "dbe], as above, the reault arroy should be reppesented as [0,2,1). Another correct answer is (2,0,1}, as the order of indexes of strings does not matter.
Ineeed help with the best performance code since I can complete this task but got only 26%. Thanks
Examples:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

=+-cach nonempty one contains a rational.

Answered: 1 week ago

Question

Additional Factors Affecting Group Communication?

Answered: 1 week ago