Thursday, 15 October 2020

Hedger Problem Description

Hedger
Problem Description
A hedger is an investor who takes steps to reduce the risks of investment by doing appropriate research and analysis of stocks. Assume that you are a hedger. 

Now you have been given some parameters based on which you have to analyze and pick the correct stocks. You have been assigned a fund that you have to manage in such a way that it should give maximum returns.

According to your research you have a list of stocks for which you know the corresponding profit percentages that you can earn within a certain horizon. Being a hedger you don't want to put all your eggs in one basket. That's why you have decided the upper limit in terms of quantity that you will buy. 

Given number of stocks, the upper limit on quantity, the amount to be invested, the list of stock prices and list of profit percentages, calculate the maximum profit you can make. 

Note: All computation should be up to two digits after the decimal point. 

Constraints 
0 <= A <= 10^6
1 <= K <= 100
1 <= N <= 10^4

Input
First line contains three space separated integers N K A where N is number of stocks in Market, K is maximum quantity of any particular stock you can buy and A is capital amount you have.

Second line contains N space separated decimals denoting the prices of stocks. 

Third line contains N space separated decimals denoting the profit percentages corresponding to the index of stock prices. 

Output
Print the maximum profit that can be earned from the given amount, rounded to the nearest integer.

Time Limit 
1 

Examples

Example 1

Input

4 2 100 

20 10 30 40 

5 10 30 20 

Output

26 

Explanation 

Here, we can select only two stocks of any stocks that we choose to buy. We choose to buy stocks which are priced at 30 and 40 respectively. Before we exhaust our capital maximum profit that can be earned
Profit=2*((30*30)/100) +1*((40*20)/100)=26 

Example 2 

Input 

5 3 200 
90 25.5 15.5 30.8 18.8 
5 10 20 5.5 2.5 

Output 

20 

Explanation 

Here, we can select only three stocks of any stocks that we choose to buy. We choose to buy stocks which are priced before we exhaust our capital maximum profit that can be earned.

Profit=3*((25.5*10)/100)+3*((15.5*20)/100)+2*((30.8*5.5)/100)=20.34 

Hence, output is 20.

What are the characteristics of Big Data?

Characteristics of Big Data:
The V's of Big Data:

1. Volume           --- The size of the data.
2. Velocity          --- Analysis of streaming data. The speed at which the data is being generated,          produced, created, or refreshed.
3. Variety            ---  Different types of data(Structured,Unstructured,Semi-structured)
4. Variability       --- The data whose meaning is constantly changing.
5. Veracity          --- Uncertainty of data (or) The trustworthiness of the data in terms of accuracy.
6. Visualization   --- The data in a manner that's readable and accessible.
7. Value             --- Just having BigData is of no use unless we can turn it into value.

Wednesday, 5 August 2020

Capgemini Selection Process in 2020

Round 1: Pseudo code test
Round 2: English(Objective test)
Round 3: Game based aptitude
Round 4: Behaviour test
Round 5: Coding Test
(Only for differential for shortlists top performers)
Round 6: Virtual Interview

Offer: salary: 3.8 LPA

Tuesday, 19 May 2020

HR interview questions?


1. Tell me about yourself?
2. Why should I hire you?
3. Tell me about your family background?
4. What are leadership qualities?
5. What do you expect from us?
6. Being an electrical engineer, why are you interested in IT?
7. Have you done any certification courses?
8. Why do you prefer TCS?
9. Why you have chosen IT industry as your career option?
10. How will you be an asset to the company?
11. What are your hobbies?
12. What is your home town famous for?
13. Do you have any problem with your locality?
14. Are you open to work at any place?
15. Which language you prefer more & why?
16. Suppose you are in a dark forest and there is no one around you. How would you get out of it?
17. How will your family react if we relocate you?

Tuesday, 17 December 2019

IBM off campus drive December 2019 coding programs

1. Sum of arithmetic progression numbers. Eg: 1+2+3+4+5 =15
2. Print number in reverse binary. Eg: Decimal =9      Binary= 1001
3. Convert number to Roman numerals.
          Eg:     Symbol         I      V        X        L
                     Value            1      5        10       50
4. Area of an ellipse.
5. Print the pyramid.
              *
           * * *
       * *  *  * *
6. Time taken to start a job , first come first serve(FCFS)

What is cyber physical system (CPS)?


A cyber-physical system (CPS) is a mechanism controlled by a computer based algorithm, strongly integrated with internet and its users. 
Examples of CPS are as follows: medical monitoring, process control systems, smart grid, robotics systems, autonomous automobile systems and automatic pilot avionics.

Friday, 13 December 2019

Python Comments

Python Comments can be used to
                  - explain Python code.
                  - make the code more readable.

Comments starts with a #, and Python will ignore them:
Single line comment
Examples
1)     #This is a comment
        print("Good Morning")
2)     print("Welcome") #This is a comment
3)    #print("Good Morning")
        print("Good Evening")

Multi Line Comments
Python does not really have a syntax for multi line comments.
To add a multiline comment you could insert a # for each line:
Example
#This is a comment
#written in
#more than just one line
print("good evening")

Multiline string(triple quotes)
multiline string (triple quotes) place your comment inside it
Example

"""
This is a comment
written in
more than just one line
"""
print("Hello, Good Morning")

Python Keywords

Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers.

and as assert break class
continue def del elif else
exceptFalsefinallyfor from
global if import in is
lambda None nonlocal not or
pass raise return True  try
while with yield

What is Python ?


  • Python is a programming language.
  • Python is a case-sensitive language.
  • It was created by Guido van Rossum, and released in 1991.
  • Python is used for web development (server-side), software development and mathematics.
  • Python can connect to database systems.
  • Python can be used to handle big data and perform complex mathematics.
  • Python is a cross-platform language,It means that Python works on different platforms i.e Windows, Mac OS X, Linux, Raspberry Pi, etc.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
  • Python can be treated in a procedural way, an object-orientated way or a functional way.
  • Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.
  • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.




Saturday, 19 October 2019

Cognizant Technical questions - off campus drives - October 2019

Technical questions
1. What is Relational database?
2. What is liner search?
3. Palindrome program with explanation?
4. what is foreign key?
5. Difference between data mining and data warehouse?
6. what is database?
7. What is primary key?
8. What is binary search?
9. Explain constraints in dbms?
10. Explain data structures?
11. Java basics
12. Sorting techniques
13. String concepts
14. Difference between C and Java
15. bubble sort program in c
16. Write a Insert query?
17. Explain oops concepts?
18. Explain about project
19. prime number program in c
20. arrays ascending order in c

Friday, 18 October 2019

ZOHO Coding Round Programs with Answers

1. Given a set of numbers like <10,36,54,89,12> we want to find sum of weights based on the following conditions.
                           1. 5 if a perfect square
                           2. 4 if multiple of 4 and divisible by 6
                           3. 3 if even number
And sort the numbers based on the weight and print it as follows
<10,its weight>, <36,its weight><89,its weight>
Should display the numbers based on increasing order.


2. Print the word with odd letters as
             P                  M
               R             A
                  O     R
                     G
                   O    R
               R           A
             P                M

Program
#include <stdio.h>
#include<string.h>

int main() {
    char s[]="PROGRAM";
    int n=strlen(s);
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==j || i+j==n-1)
            {
                printf("%c",s[i]);
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }
   
    return 0;
}

3. Print the elements in anti spiral order
for example
Matrix
1  2  3
4  5  6
7  8  9

output
5 6 9 8 7 4 1 2 3

4. given an array of integers rearrange the array in such a way that the first element is first maximum and second element is first minimum.

Example
Input - {1,2,3,4,5,6,7}
Output - {7,1,6,2,5,3,4}

5. Remove unbalanced parentheses in a given expression.
Example
Input:   ((abc)((de))
Output: ((abc)(de))

Input: (((ab)
Output: (ab)

6.Form a number system with only 3 and 4. Find the nth number of the number system.
Example
3,4,33,34,43,44,333,334,343,344,433,434,443,444 and so on.

7. Check whether a given mathematical expression is valid.
Example
Input:  (a+b)(a*b)         Output: Valid
Input: (ab)(ab+)            Output: Invalid
Input:  ((a+b)                Output: Invalid

8.Write a program to give the following output for the given input:
Example1
Input:  a1b10                output: abbbbbbbbbb
Example2
Input:  b3c6d15            output: bbbccccccddddddddddddddd
The number varies from 1 to 99.

9. Using recursion reverse the string such as:
Example
Input:  alpha beta gamma
Output: gamma beta alpha

10. Given two sorted arrays, merge them such that the elements are not repeated.
Input:
      Array 1 : 2,4,5,6,7,9,10,13
      Array 2 : 2,3,4,5,6,7,8,9,11,15
Output:
      Merged array:
2,3,4,5,6,7,8,9,10,11,13,15


11. Given a string, reverse only vowels in it; leaving rest of the string as it is.
Input:  abcdef
Output: ebcdaf

12. Write a program to determine whether a given number can be expressed as sum of two prime numbers or not.
For example, 34 can be expressed as sum of two prime numbers but 23 cannot be.

13. Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words. See following examples for more details.
Consider the following dictionary 
{ i, like, sam, sung, samsung, mobile, ice, cream, icecream, man, go, mango} 
Input: ilike 
Output: Yes 
The string can be segmented as "i like". 

Input: ilikesamsung 
Output: Yes
The string can be segmented as "i like samsung"

14. Print the following pattern.
                           1
                         3  2 
                       6  5  4 
                   10  9  8  7 
                   10  9  8  7 
                       6  5  4 
                         3  2
                           1
15. Given an array as input, The condition is if the number is repeated you must add the number and put the next index value to 0. If the number is 0 print it at the last.
Eg: arr[] = { 0, 2, 2, 2, 0, 6, 6, 0, 8} 
      Output: 4 2 12 8 0 0 0 0 0

16. Two strings of equal length will be given. Print all the adjacent pairs which are not equal. 
Input: asdfghij and adsfgijh 
Output: sd-ds, hij-ijh

17. From the input sentence given, find the strings which are not palindrome and print it. 
Input: he knows malayalam 
Output: he knows

18. Given two Strings s1 and s2, remove all the characters from s1 which is present in s2. 
Input: s1=”expErIence”, 
           s2=”En” 
output: s1=”exprIece”

19. Given an array with repeated numbers, Find the top three repeated numbers. 
input: array[]={3, 4, 2, 3, 16, 3, 15, 16, 15, 15, 16, 2, 3} 
output: 3, 16, 15

20. It’s about anagram. input was array of strings .and a word was given to find whether it has anagram in given array. 
Input:  catch, got, tiger, mat, eat, Pat, tap, tea 
Word: ate 
Output: eat, tea

Sunday, 15 September 2019

Cocubes essay writing topics for Capgemini - September -2019

1. Analog vs digital
2. Change is only the constant.
3. Students nowadays can learn much more than what is taught inside the classroom.
4. The road less traveled is not necessarily the wrong one.
5. Success vs ethics
6. You can not judge a book by its cover
7. Can honestly be taught?
8. A chain is only as strong as its weakest link.
9. It's a lonely journey to the top.

Saturday, 7 September 2019

HR Interview questions and answers for freshers

1. Tell me about your self?
My name is narendra. I live in Tirupati. I have done M.Tech in computer science and engineering.
Job experience if any (internships).
Family details in short.

2. Why do you want to work at our company?
 Tell them what you like about company.
Relate it to your long-term career goals.

For Example
Sir/Madam, it is great privilege for anyone to work in a reputed company like yours. When I read about your company I found that my skills are matching your requirements. Where I can showcase my technical skills to contribute to the company growth.

3. What are your strengths?
Interviewers want to know how your strengths beneficial for the company.
Taking Initiative.
Creativity
Self motivated
Persistence - regular in your work.
Adaptability -  adjustable to any kind of environment situation.
Hard working
Optimistic - positive attitude.
Fast decision making

For Example
I am a self motivated and hardworking with positive attitude towards my career and my life.

4. What are your Weakness? (The strategy: Turn a strength into a weakness)

I work too hard.
Too detail oriented.

5. Why should I hire you?

Sir/Madam, as I am a fresher, I have theoretical knowledge but I can do hard work for my organization. And I will put all my efforts for the good progress of organization. Being punctual and sincere, I can finish the work given to me on time and try my best to fulfill all the needs of company from me.





Friday, 6 September 2019

Cocubes essay writing topics for Capgemini - September -2018

1. Newspapers will become extinct in the next 20 years.
2. Rome was not built in a day.
3. The gap between laptops and smartphones is decreasing.
4. Time once lost, is lost forever.
5. Books or people, whom do we learn more from?
6. Records are meant to be broken?
7. Artificial Intelligence a threat or a boon?
8. Hard-work or talent which one is more important to succeed in workplace?

Friday, 31 January 2014

What Is a Design Pattern?


  • Christopher Alexander says, "Each pattern describes a problem which occurs over and over again in our environment , and then describes the core of the solution to that problem, in such way that you can use this solution a million times over, without ever doing it the same way twice".
  • Advantage of design pattern is Re-usability of solutions.
  • a pattern has four essential elements.
  1. Pattern name
  2. Problem
  3. Solution
  4. Consequences

Pattern name-It is a unique name which describes a design problem.It improves communication among developers.
Problem-It states the problem ,how to represent algorithms as objects.It ensures when the pattern is applicable and what conditions should be met before the pattern is used.
Solution-It provides description of elements that make design pattern such as their responsibilities, relationships and collaborations.Pattern solution can't describe a particular implementation because patterns are like  template that are applicable to several similar situations.
Consequences-Highlight the results,pros and cons of applying the pattern.It describes the impacts on system portability, extensibility .