Machine Learning Intern Interview Questions

8,195 machine learning intern interview questions shared by candidates

Write a function to rearrange a list of article types so that no two consecutive articles are of the same type. If such an arrangement is not possible, return False. Input: articles (List[str]): A list of strings where each string represents an article type. Strings are case-sensitive. Output: List[str]: A valid arrangement of articles where no two consecutive elements are the same. bool: Return False if no valid arrangement exists. Examples: Input: ["sports", "media", "sports"] Output: ["sports", "media", "sports"] Input: ["sports", "sports", "sports"] Output: False Input: ["sports", "media", "news", "media", "sports"] Output: ["sports", "media", "sports", "news", "media"]
avatar

Senior Machine Learning Engineer

Interviewed at Pinterest

3.6
Dec 13, 2024

Write a function to rearrange a list of article types so that no two consecutive articles are of the same type. If such an arrangement is not possible, return False. Input: articles (List[str]): A list of strings where each string represents an article type. Strings are case-sensitive. Output: List[str]: A valid arrangement of articles where no two consecutive elements are the same. bool: Return False if no valid arrangement exists. Examples: Input: ["sports", "media", "sports"] Output: ["sports", "media", "sports"] Input: ["sports", "sports", "sports"] Output: False Input: ["sports", "media", "news", "media", "sports"] Output: ["sports", "media", "sports", "news", "media"]

The second question was similar to the first to rearrange the characters if in a string they are adjacent to each other. There must not be no two same adjacent characters. If there is no way to rearrange, return an empty string. Ex: given string - ‘aabbbcda’ Output- ‘abcbdaba’
avatar

Machine Learning Co-op

Interviewed at Lendbuzz

3.9
Dec 23, 2024

The second question was similar to the first to rearrange the characters if in a string they are adjacent to each other. There must not be no two same adjacent characters. If there is no way to rearrange, return an empty string. Ex: given string - ‘aabbbcda’ Output- ‘abcbdaba’

Viewing 401 - 410 interview questions

Glassdoor has 8,195 interview questions and reports from Machine learning intern interviews. Prepare for your interview. Get hired. Love your job.