Solutions Architect Interview Questions
- 3of 3 votes
AnswersGiven estimated stock quotes, in an array, print the maximum profit from a buy and sell. i.e [19, 22, 15, 35, 40, 10, 20] would show a profit of 25(40 -15). The sale must come after the buy. Solve this in O(N) time.
- mcg1coding February 13, 2017 in United States<?php function print_max_profit($arr){ if(count($arr) < 1) return 0; $len = sizeof($arr); $profit = 0; $least = $arr[0]; for($i = 0; $i < $len; $i++){ $least = min($least,$arr[$i]); $profit = max($profit, $arr[$i] - $least); } return $profit; }
| Report Duplicate | Flag | PURGE
Facebook Solutions Architect - 0of 0 votes
AnswersSort a array in such a way that the duplicates are also in
- bharadwajdaya July 12, 2016 in India
for ex
2 arrays
0 1 3 5
1 2 3 4
output should be
01123345| Report Duplicate | Flag | PURGE
Citigroup Solutions Architect - 0of 0 votes
Answerswhat is the output of the following and justify ?
- sumit January 07, 2015 in India
#include <stdio.h>
int main()
{
printf(&unix["\0c%set\012"],(unix)["chak"]+"Trick"-0x67);
}| Report Duplicate | Flag | PURGE
Broadsoft Solutions Architect C - 0of 0 votes
AnswersDesign the below scenario in Java.
- cCAACc May 31, 2013 in United States
In an Olympic event there is a running track and it is used for 100m,200m,400m. You have 10 participants.
When the event start , capture the time taken by each participants. Determine who is the winner in each event.| Report Duplicate | Flag | PURGE
Barclays Capital Solutions Architect Object Oriented Design - 0of 0 votes
AnswersDesign the below scenario in Java.
- cCAACc May 31, 2013 in United States
You have to maintain the family tree of 10 generation. For a family you have to store father, mother and their children.
You have do the following operation.
When you search by a particular name of father/children, It will print whole 10 generation.
Calculate the time and space efficiency of your search operation.| Report Duplicate | Flag | PURGE
Barclays Capital Solutions Architect Object Oriented Design - 0of 0 votes
AnswersHow do we design a class.forName("CLASS") , kind of function?
- hprem991 March 27, 2013 in United States
Where the function will accept a string (as a Class Name) as a parameter and accordingly convert it into the subsequent CLASS object.| Report Duplicate | Flag | PURGE
Solutions Architect Algorithm C++ - 0of 0 votes
AnswerWrite an algorithm to convert string "1234.56" to its float equivalent.
Solution:
- Rahul Telang November 02, 2010using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MSIntervewPreparation { class ConvertStringToFloat { static void Main(string[] args) { string str = "1234.56"; float num = 0.0F; float multiplier = 0.1F; bool isDecimalReached = false; for (int i = 0; i < str.Length; i++) { if (str[i] == '.') { isDecimalReached = true; continue; } if (!isDecimalReached) { num = (num * 10) + (str[i] - '0'); } else { num += (str[i] - '0') * multiplier; multiplier *= 0.1F; } } Console.WriteLine("Input String: " + str); Console.WriteLine("Float Number: {0} ", num); } } }
| Report Duplicate | Flag | PURGE
HCL America Solutions Architect String Manipulation - 0of 0 votes
AnswersWrite a function to convert "1234.56" into its float equivalent.
Solution:
- Rahul Telang November 02, 2010using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MSIntervewPreparation { class ConvertStringToFloat { static void Main1(string[] args) { string str = "1234.56"; float num = 0.0F; float multiplier = 0.1F; bool isDecimalReached = false; for (int i = 0; i < str.Length; i++) { if (str[i] == '.') { isDecimalReached = true; continue; } if (!isDecimalReached) { num = (num * 10) + (str[i] - '0'); } else { num += (str[i] - '0') * multiplier; multiplier *= 0.1F; } } Console.WriteLine("Input String: " + str); Console.WriteLine("Float Number: {0} ", num); } } }
| Report Duplicate | Flag | PURGE
HCL America Solutions Architect String Manipulation - 0of 0 votes
AnswersDesign a format that describes the pathways you can traverse in the game Zelda.
- Brian July 29, 2010| Report Duplicate | Flag | PURGE
Zillow Solutions Architect Trees and Graphs