Reverse string in c++

Problem A typical interview question is to describe an algorithm to reverse a string of characters. Solution We need one pass through the characters of the string to get the string length or use a built in function to get that. Once the length of the string is found then one for loop can be

Sql relational division example

Problem Given the following database tables Employee (SSN, name, location) Assigned (SSN, project_name, duration) Project (project_name, category, budget, location) Write SQL statements to find the following: Project names with a budget smaller than the average budget of projects in a given category let us say "Test Category" Employees who are assigned to all projects with

3 Ants Triangle Puzzle

Triangle ants problem Three ants on the corners of an equilateral triangle. They started moving along the edges at the same speed. What is the probability that the ants will collide ? Solution Each ant could possibly be moving in one direction let us say Left or Right. We have three ants with two possible

Word count perl script

Find word count using perl Write a perl program that prints word count in file. For example if the input file contains the following word occurrences "Santa Clara is located in Santa Clara county" the program should print something like: Santa: 2 Clara: 2 is: 1 located: 1 in: 1 county: 1 Word count perl

Perl compare two arrays

Two arrays differences Given two integer arrays A and B of the same size each having no duplicate values. Write an equality function that returns true if A and B are equivalent. The arrays are equivalent if they contain the same content regardless of order. The function should return false if the arrays are not