`{"id":"bd8ab772-a663-4953-8f09-3e4fb9d33be5","name":"Highest Frequency Character","description":"1. You are given a string str.\r\n2. You are required to find the character with maximum frequency.","inputFormat":"A string str","outputFormat":"The character with highest frequency","constraints":"0 &lt; str.length() &lt;= 100\r\nThere will be a single character with highest frequency","sampleCode":{"cpp":{"code":"#include <bits/stdc++.h>\nusing namespace std;\n\nint main() \n \n string str;\n cin >> str;\n\n// write your code here\n\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"string = input()\n\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"zmszeqxllzvheqwrofgcuntypejcxovtaqbnqyqlmrwitc","sampleOutput":"q","questionVideo":"https://www.youtube.com/embed/o_21yt_tgHk","hints":[],"associated":[{"id":"131cd065-5b57-4f4e-ae32-cd5c8d345d9f","name":"What will be the space complexity of this problem if you use Hashmap or HashSet? (Highest frequency character)","slug":"what-will-be-the-space-complexity-of-this-problem-if-you-use-hashmap-or-hashset-highest-frequency-character","type":4},{"id":"91fae3c6-f7bf-4ad5-ab9c-a8be3e043ec0","name":"Map implements collection interface? (Highest frequency character)","slug":"map-implements-collection-interface-highest-frequency-character","type":4},{"id":"e03c57d0-bb55-49f7-918e-c0dfdc6ae3d4","name":"Which data structure can be used to solve this problem in O(n) time complexity? (Highest frequency character)","slug":"which-data-structure-can-be-used-to-solve-this-problem-in-o-n-time-complexity-highest-frequency-character-14864","type":4},{"id":"fe4e3d26-1576-4c17-9980-12d8a36eeaf1","name":"Which of the below does not implement Map interface? (Highest frequency character)","slug":"which-of-the-below-does-not-implement-map-interface-highest-frequency-character","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":"1254d21e-2209-40bc-9e24-00d135ace68d","name":"Hashmap And Heap For Beginners","slug":"hashmap-and-heap-for-beginners","type":0},{"id":"acb1b409-3a87-4b4e-a2b3-5cb0e1076f22","name":"Highest Frequency Character","slug":"highest-frequency-character","type":1}],"next":{"id":"ba794a45-2b3c-4420-888c-e6796e40a0b9","name":"Highest Frequency Character","type":3,"slug":"highest-frequency-character"},"prev":{"id":"a9436cd7-510b-48a7-ace2-9711da469be7","name":"Introduction to Hashmaps","type":3,"slug":"introduction-to-hashmaps"}}}`

# Highest Frequency Character

1. You are given a string str. 2. You are required to find the character with maximum frequency.

`{"id":"bd8ab772-a663-4953-8f09-3e4fb9d33be5","name":"Highest Frequency Character","description":"1. You are given a string str.\r\n2. You are required to find the character with maximum frequency.","inputFormat":"A string str","outputFormat":"The character with highest frequency","constraints":"0 &lt; str.length() &lt;= 100\r\nThere will be a single character with highest frequency","sampleCode":{"cpp":{"code":"#include <bits/stdc++.h>\nusing namespace std;\n\nint main() \n \n string str;\n cin >> str;\n\n// write your code here\n\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n // write your code here\r\n }\r\n\r\n}"},"python":{"code":"string = input()\n\n#write your code here"}},"points":10,"difficulty":"easy","sampleInput":"zmszeqxllzvheqwrofgcuntypejcxovtaqbnqyqlmrwitc","sampleOutput":"q","questionVideo":"https://www.youtube.com/embed/o_21yt_tgHk","hints":[],"associated":[{"id":"131cd065-5b57-4f4e-ae32-cd5c8d345d9f","name":"What will be the space complexity of this problem if you use Hashmap or HashSet? (Highest frequency character)","slug":"what-will-be-the-space-complexity-of-this-problem-if-you-use-hashmap-or-hashset-highest-frequency-character","type":4},{"id":"91fae3c6-f7bf-4ad5-ab9c-a8be3e043ec0","name":"Map implements collection interface? (Highest frequency character)","slug":"map-implements-collection-interface-highest-frequency-character","type":4},{"id":"e03c57d0-bb55-49f7-918e-c0dfdc6ae3d4","name":"Which data structure can be used to solve this problem in O(n) time complexity? (Highest frequency character)","slug":"which-data-structure-can-be-used-to-solve-this-problem-in-o-n-time-complexity-highest-frequency-character-14864","type":4},{"id":"fe4e3d26-1576-4c17-9980-12d8a36eeaf1","name":"Which of the below does not implement Map interface? (Highest frequency character)","slug":"which-of-the-below-does-not-implement-map-interface-highest-frequency-character","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":"1254d21e-2209-40bc-9e24-00d135ace68d","name":"Hashmap And Heap For Beginners","slug":"hashmap-and-heap-for-beginners","type":0},{"id":"acb1b409-3a87-4b4e-a2b3-5cb0e1076f22","name":"Highest Frequency Character","slug":"highest-frequency-character","type":1}],"next":{"id":"ba794a45-2b3c-4420-888c-e6796e40a0b9","name":"Highest Frequency Character","type":3,"slug":"highest-frequency-character"},"prev":{"id":"a9436cd7-510b-48a7-ace2-9711da469be7","name":"Introduction to Hashmaps","type":3,"slug":"introduction-to-hashmaps"}}}`

Editor

# Highest Frequency Character

easy

1. You are given a string str. 2. You are required to find the character with maximum frequency.

## Constraints

0 < str.length() <= 100 There will be a single character with highest frequency

## Format

A string str

### Output

The character with highest frequency

## 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;}zmszeqxllzvheqwrofgcuntypejcxovtaqbnqyqlmrwitc`

### 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;}q`

Question Video

Discussions

Show Discussion

Related Resources