Global Trend Programming Profile Assessment
Questions
Welcome to the Global Trend Programming Profile assessment. This document outlines the
requirements and guidelines for completing the programming assessment. Please read the
instructions carefully before you begin.
Assessment Overview
This assessment consists of 10 programming questions designed to evaluate your
problem-solving and coding skills in C++. You are required to attempt all the questions within a
1-day time period. The assessment is timed, and your submissions will be evaluated based on
correctness, efficiency, and coding best practices.
Instructions
1. Time Limit: You have 24 hours to complete all 10 questions from the moment you start
the assessment.
2. Programming Language: All solutions must be written in C++.
3. Submission:
○ Word Document: Create a Word document containing your code for each
question along with screenshots of the output. Name the file
Programming_Assessment_YourName.docx.
○ GitHub Profile: Create a GitHub profile if you don't already have one. Upload all
your code files to a new repository named
GlobalTrend_Programming_Assessment.
Questions
1. Write a function to reverse a singly linked list.The function should take the head of the
list and return the new head of the reversed list.
2. Given a string, find the length of the longest substring without repeating characters.The
function should return an integer representing the length of the longest substring without
repeating characters.
3. Given a non-empty binary tree, find the maximum path sum. A path is defined as any
sequence of nodes from some starting node to any node in the tree along the
parent-child connections. The path must contain at least one node and does not need to
go through the root.The function should return an integer representing the maximum
path sum.
4. Design an algorithm to serialize and deserialize a binary tree. Serialization is the process
of converting a data structure or object into a sequence of bits so that it can be stored in
a file or memory buffer, or transmitted across a network connection link to be
reconstructed later in the same or another computer environment. Implement the
serialize and deserialize methods.
5. Write a function to rotate an array to the right by k steps.The function should modify the
array in place to achieve the rotation.
6. Write a function to find the factorial of a given number.The function should return the
factorial of the number.
7. Write a function to compute the sum of the digits of a given number.The function should
return the sum of the digits of the number.
8. Write a function to find the greatest common divisor (GCD) of two numbers. The function
should return the GCD of a and b.
9. Write a function to find the maximum difference between any two elements in an
array.The function should return the maximum difference between any two elements in
the array.
10. Write a function to check if a given string contains only alphabetic characters.The
function should return true if the string contains only alphabetic characters, and false
otherwise.