countCandies has the following parameter(s): There are friends_nodes friends, number different candies. There are friends is connected by the common candy that they both like. Candies are numbered 1 to friends_nodes, who like to eat lof friends where each pair Open with - friends friends_nodes: an integer, the number of friends friends_from[friends_from[0,.friends_from[n-1]]: an integer array where each from 1 to 100. Note that if xi] and y] are connected by a candy cfi]and yfi] and zi] element denotes the first friend in the pair are also connected by the candy cli], then x[i] and zī] are also said to be connected friends_toffriends_to[0]...friends_to[n-1]]: an integer array where each element denotes the second friend in the pair by cf]. Find the maximal product of x[i] and yli] so that x[i] and y[i] share the largest group of friends which is connected by some common candy. As an example, assume the following 6 inputs: From To Candy 1 51 51 6. 51 10 8 51 6 51 2. 3 51 Everyone likes the same candy, but not everyone is connected. A graphical friends_weightffriends_weight(0],.friends_weight[n-1]: an integer array where representation is: each element denotes a candy liked by both friends The largest group is [1, 2, 3, 7] and its largest elements are 3 and 7. Their product is Constraints 2 s friends_nodes s 100 1 s friends_edges s min(200, e 1s friends_weight[i] s 100 1s friends_from[i]), friends_to[i] s friends_nodes 1s friends_weight[i] s friends_edges friends from[i] friends toli Each pair of friends can 21. Function Description Complete the function countCandies in the editor below. The function must return an integer that represents t Page + numbers in the largest of candy group

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
I need the answer quickly
countCandies has the following parameter(s):
1 to friends_nodes, who like to eat
different candies. There are friends sof friends where each pair of friends
is connected by the common candy that they both like. Candies are numbered
There are friends nodes friends, numi
friends_nodes: an integer, the number of friends
pairs
friends_from[friends_from[0]...friends_from[n-1]]: an integer array where each
from 1 to 100. Note that if x[i] and y[ī] are connected by a candy c[i]and yli] and z[i]
are also connected by the candy c[i], then x[i] and z[ī] are also said to be connected
by c[i]. Find the maximal product of x[i] and y[i] so that x[i] and y[i] share the largest
element denotes the first friend in the pair
friends_to[friends_to[0]..friends_to[n-1]]: an integer array where each element
denotes the second friend in the pair
group of friends which is connected by some common candy.
As an example, assume the following 6 inputs:
From
To
Candy
2
51
7
3
51
6
51
10
8
51
6
9
51
51
Everyone likes the same candy, but not everyone is connected. A graphical
friends_weight[friends_weight[0],..friends_weight[n-1]]: an integer array where
representation is:
each element denotes a candy liked by both friends
The largest group is [1, 2, 3, 7] and its largest elements are 3 and 7. Their product is
Constraints
2 s friends_nodes s 100
1 s friends_edges s min(200, mena na fiente ake- /)
1s friends_weight|i] s 100
1s friends_from[i], friends_to[i] s friends_nodes
15 friends_weight[i] < friends_edges
friends_from] # friends_tofi]
Each pair of friends can
21.
Function Description
Complete the function countCandies in the editor below. The function must return an
integer that represents thae
1 tha maxiimumo
numbers in the largest
group.
connected by
|of candy
Page
2I 4
Transcribed Image Text:countCandies has the following parameter(s): 1 to friends_nodes, who like to eat different candies. There are friends sof friends where each pair of friends is connected by the common candy that they both like. Candies are numbered There are friends nodes friends, numi friends_nodes: an integer, the number of friends pairs friends_from[friends_from[0]...friends_from[n-1]]: an integer array where each from 1 to 100. Note that if x[i] and y[ī] are connected by a candy c[i]and yli] and z[i] are also connected by the candy c[i], then x[i] and z[ī] are also said to be connected by c[i]. Find the maximal product of x[i] and y[i] so that x[i] and y[i] share the largest element denotes the first friend in the pair friends_to[friends_to[0]..friends_to[n-1]]: an integer array where each element denotes the second friend in the pair group of friends which is connected by some common candy. As an example, assume the following 6 inputs: From To Candy 2 51 7 3 51 6 51 10 8 51 6 9 51 51 Everyone likes the same candy, but not everyone is connected. A graphical friends_weight[friends_weight[0],..friends_weight[n-1]]: an integer array where representation is: each element denotes a candy liked by both friends The largest group is [1, 2, 3, 7] and its largest elements are 3 and 7. Their product is Constraints 2 s friends_nodes s 100 1 s friends_edges s min(200, mena na fiente ake- /) 1s friends_weight|i] s 100 1s friends_from[i], friends_to[i] s friends_nodes 15 friends_weight[i] < friends_edges friends_from] # friends_tofi] Each pair of friends can 21. Function Description Complete the function countCandies in the editor below. The function must return an integer that represents thae 1 tha maxiimumo numbers in the largest group. connected by |of candy Page 2I 4
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education