Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are working in a chemical factory. Each chemical in the factory is represented by a string. You have to group the chemicals in such
You are working in a chemical factory. Each chemical in the factory is represented by a string. You have to group the chemicals in such a way that no two explosive chemicals are together. You are given an array of size N denoting the names of N chemicals. Let x and y be two strings representing two chemicals. Let zxx For example, if x"abc"
then z"abcabc
The chemicals x and y are said to be explosive if we can jumble the characters of string z to get chemical y Your task is to return the number of pairs of chemicals that are explosive. Input Specification: input: An integer N denoting the size of the array. input: An array of strings denoting the names of N chemicals.
Output Specification:
An integer denoting the number of pairs of chemicals that are explosive.
Example :
input:
input: hacker "int", "niitnt", "hackhackerer", "long"
Output:
Example :input:input: medium "easy", "yeasseya"Output:
write a c code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started