Search Your Question...!

Showing posts with label Problem Solving. Show all posts
Showing posts with label Problem Solving. Show all posts

R-dplyrops-fdadata

From a given data set fda which contains data on warning letters sent to doctors by the U.S. Food and Drug Administration, because of problems in the way in which they ran clinical trials testing experimental treatments. Contains the following variables:

name_last name_first name_middle Doctor’s last, first, and middle names.

issued Date letter was sent.

office Office within the FDA that sent the letter.

Now,

(a)Include the packages required and read the data from the data set fda.

(b)Filter the data for letters sent from the start of 2005(1'st January 2005) onwards and print it. 

(c)Count the number of letters issued by year and print it .

Git: Stashing changes - Basic (Java)

 Welcome to Git: Stashing changes - Basic (Java).

This question is used to evaluate your skills on stashing the changes in Git.

For this, you will be evaluated based on the following operations. The remote repository has been pre-configured into your local git repository.

  1. Your local git repository will be linkedlist_java.
  2. Push the master branch of local git repository to the remote repository.
  3. Create a new branch with the name new_branch.
  4. Make a change to the Java program file (do not remove it), make a commit and push the branch.
  5. Make a few more changes to the Java program file and stash those changes.

FOOD FEST Using Python

A food fest is organised at the JLN stadium. The stalls from different states and cities have been set up. To make the fest more interesting, multiple games have been arranged which can be played by the people to win the food vouchers. One such game to win the food vouchers is described below:

There are N number of boxes arranged in a single queue. Each box has an integer I written on it. From the given queue, the participant has to select two contiguous subsequences A and B of the same size. The selected subsequences should be such that the summation of the product of the boxes should be maximum. The product is not calculated normally though. To make the game interesting, the first box of subsequence A is to be multiplied by the last box of subsequence B. The second box of subsequence A is to be multiplied by the second last box of subsequence B and so on. All the products thus obtained are then added together.

If the participant is able to find the correct such maximum summation, he/she will win the game and will be awarded the food voucher of the same value.

Note: The subsequences A and B should be disjoint.

Find the Winner using Python

Andrea and Maria each have a deck of numbered cards in a pile face down. They play a game where they each alternately discard and flip the cards on the pile from top to bottom.

At the beginning of the game, someone will call out "Even" or "Odd". The first move depends on which is called. If "Even" is called, the player's top cards are flipped so they can see the face value. If instead "Odd" is called, the top card is removed from each deck and discarded, then each flips her next card. Andrea subtracts the value of Maria's card from her own and adds the result to her score. Likewise, Maria subtracts the value of Andrea's card from her own and adds the result to her score.

From this point forward, each alternately discards then flips a card. Each time two cards are flipped, the players' scores are computed as before. Once all the cards have been played, whoever has the most points wins.

As an example, Maria's cards, face down, are [3, 5, 6] and Andrea's are [4, 5, 7]. After calling "Even" at random, the game begins. The following table represents game play with cumulative score at the bottom. Maria's score is -2, Andrea's is +2 so Andrea wins.