Fanatics Code assessment

fanatics logo
fanatics
December 4, 202558 reads

Summary

I completed a code assessment for Fanatics where I was tasked with creating an ASCII chart display program based on a given set of data points.

Full Experience

I was given a code assessment for Fanatics. The task involved writing a program that could display an ASCII chart from a given dataset of (x, y) coordinates. The chart needed to show the surrounding components and mark each data point with an asterisk. I also had to consider the max_x and max_y values, either provided or calculated, to properly scale the chart. The example provided illustrated an online auction graph with time on the x-axis and price on the y-axis.

Interview Questions (1)

Q1
ASCII Chart Display Program
Data Structures & Algorithms

Write a program in the requested language that will display an ASCII chart given the following data:

data = {(1,2), (2, 3), (3, 1), (4, 6), (5, 8)}

You should be able to print the surrounding components of the chart and then place an * where each data point is specified in the data set. You do not need to print the X and Y legends, but that would be helpful. You are given the max x and max y but if you can calculate that it would be helpful.

Example Output Structure:

     +-----+-----+-----+-----+-----+-----
     +                             *     +
     +                                   +
     +                       *           +
   $ +                                   +
     +                                   +
     +           *                       +
     +     *                             +
     +                 *                 +
     +-----+-----+-----+-----+-----+-----+
                   time

Given Parameters:

  • max_x = 5
  • max_y = 8
  • data = {{1,2}, {2, 3}, {3, 1}, {4, 6}, {5, 8}}
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!