`{"id":"ee0cbace-86ab-4ac5-9855-89cf5ec5e587","name":"Bar Chart","description":"1. You are given a number n, representing the size of array a.\r\n2. You are given n numbers, representing elements of array a.\r\n3. You are required to print a bar chart representing value of arr a.","inputFormat":"A number n\r\nn1\r\nn2\r\n.. n number of elements","outputFormat":"A bar chart of asteriks representing value of array a","constraints":"1 &lt;= n &lt;= 30\r\n0 &lt;= n1, n2, .. n elements &lt;= 10","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\n\r\nint main(){\r\n //write your code here\r\n \r\n \r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"n=int(input())\n//write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5\r\n3\r\n1\r\n0\r\n7\r\n5","sampleOutput":"\t\t\t*\t\t\r\n\t\t\t*\t\t\r\n\t\t\t*\t*\t\r\n\t\t\t*\t*\t\r\n*\t\t\t*\t*\t\r\n*\t\t\t*\t*\t\r\n*\t*\t\t*\t*\t","questionVideo":"https://www.youtube.com/embed/85gIj4eBdBA","hints":[],"associated":[{"id":"44bb12ed-b87b-4977-a751-82756bd4f349","name":"(Bar Chart) What will be the time complexity of the question?","slug":"bar-chart-what-will-be-the-time-complexity-of-the-question","type":4},{"id":"4a12c0d7-8fbb-4e20-89bb-01cebb18af99","name":"(Bar Chart) What will be the space complexity of the question?","slug":"bar-chart-what-will-be-the-space-complexity-of-the-question","type":4},{"id":"99f5edec-1b60-4bb7-88d9-b1748177db8c","name":"(Bar Chart) How many no. of rows are going to be printed?","slug":"bar-chart-how-many-no-of-rows-are-going-to-be-printed","type":4},{"id":"e471c850-4f88-4392-894b-5a1c18125d3c","name":"(Bar Chart) How many no. of columns are going to be printed?","slug":"bar-chart-how-many-no-of-columns-are-going-to-be-printed","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f10b54f1-0f44-408f-82d5-89c189f4ad57","name":"Function and Arrays","slug":"function-and-arrays","type":0},{"id":"fb0b38c2-0ed6-4e9d-8c28-541d16e49cd4","name":"Bar Chart","slug":"bar-chart","type":1}],"next":{"id":"e4cedbbb-fe81-4f9b-b098-be94e779ddb9","name":"BAR CHART","type":3,"slug":"bar-chart"},"prev":{"id":"54dd34d1-cc36-4bac-8b20-e9c3a5f6e44e","name":"Find element in an Array","type":3,"slug":"find-element-in-an-array"}}}`

# Bar Chart

1. You are given a number n, representing the size of array a. 2. You are given n numbers, representing elements of array a. 3. You are required to print a bar chart representing value of arr a.

`{"id":"ee0cbace-86ab-4ac5-9855-89cf5ec5e587","name":"Bar Chart","description":"1. You are given a number n, representing the size of array a.\r\n2. You are given n numbers, representing elements of array a.\r\n3. You are required to print a bar chart representing value of arr a.","inputFormat":"A number n\r\nn1\r\nn2\r\n.. n number of elements","outputFormat":"A bar chart of asteriks representing value of array a","constraints":"1 &lt;= n &lt;= 30\r\n0 &lt;= n1, n2, .. n elements &lt;= 10","sampleCode":{"cpp":{"code":"#include<iostream>\r\nusing namespace std;\r\n\r\n\r\nint main(){\r\n //write your code here\r\n \r\n \r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n\r\npublic static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"n=int(input())\n//write your code here"}},"points":10,"difficulty":"easy","sampleInput":"5\r\n3\r\n1\r\n0\r\n7\r\n5","sampleOutput":"\t\t\t*\t\t\r\n\t\t\t*\t\t\r\n\t\t\t*\t*\t\r\n\t\t\t*\t*\t\r\n*\t\t\t*\t*\t\r\n*\t\t\t*\t*\t\r\n*\t*\t\t*\t*\t","questionVideo":"https://www.youtube.com/embed/85gIj4eBdBA","hints":[],"associated":[{"id":"44bb12ed-b87b-4977-a751-82756bd4f349","name":"(Bar Chart) What will be the time complexity of the question?","slug":"bar-chart-what-will-be-the-time-complexity-of-the-question","type":4},{"id":"4a12c0d7-8fbb-4e20-89bb-01cebb18af99","name":"(Bar Chart) What will be the space complexity of the question?","slug":"bar-chart-what-will-be-the-space-complexity-of-the-question","type":4},{"id":"99f5edec-1b60-4bb7-88d9-b1748177db8c","name":"(Bar Chart) How many no. of rows are going to be printed?","slug":"bar-chart-how-many-no-of-rows-are-going-to-be-printed","type":4},{"id":"e471c850-4f88-4392-894b-5a1c18125d3c","name":"(Bar Chart) How many no. of columns are going to be printed?","slug":"bar-chart-how-many-no-of-columns-are-going-to-be-printed","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f10b54f1-0f44-408f-82d5-89c189f4ad57","name":"Function and Arrays","slug":"function-and-arrays","type":0},{"id":"fb0b38c2-0ed6-4e9d-8c28-541d16e49cd4","name":"Bar Chart","slug":"bar-chart","type":1}],"next":{"id":"e4cedbbb-fe81-4f9b-b098-be94e779ddb9","name":"BAR CHART","type":3,"slug":"bar-chart"},"prev":{"id":"54dd34d1-cc36-4bac-8b20-e9c3a5f6e44e","name":"Find element in an Array","type":3,"slug":"find-element-in-an-array"}}}`

Editor

# Bar Chart

easy

1. You are given a number n, representing the size of array a. 2. You are given n numbers, representing elements of array a. 3. You are required to print a bar chart representing value of arr a.

## Constraints

1 <= n <= 30 0 <= n1, n2, .. n elements <= 10

## Format

### Input

A number n n1 n2 .. n number of elements

### Output

A bar chart of asteriks representing value of array a

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}5 3 1 0 7 5```

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;} * * * * * * * * * * * * * * * * ```

Question Video

Discussions

Show Discussion

Related Resources