Adding Python code for Problem number 697: degree of an array
Pull Request Template
Description
Solution to Problem 697 on LeetCode. Question: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.
Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums.
Solution: Iterate through the list of numbers whike keeping track of the counter of leftmost and rightmost indices of the numbers We then find the largest number and return the length
Put check marks:
Have you made changes in README file ?
- [*] Added problem & solution under correct topic.
- [*] Specified Space & Time complexity.
- [*] Specified difficulty level, tag & Note(if any).
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.
- [*] Test A
- [*] Test B
Make sure all below guidelines are followed else PR will get Reject:
- [*] My code follows the style guidelines of this project
- [*] I have performed a self-review of my own code
- [*] I have commented my code so that it is easy to understand
- [*] I have made corresponding changes to the documentation
- [*] My changes generate no new warnings
- [*] Any dependent changes have been merged and published in downstream modules
I can tell this is your first pull request! Thank you I'm so honored. :tada::tada::tada: I'll take a look at it ASAP!
@GouravRusiya30 Are there any changes that should be done for the PR to be valid? I would be happy to update the files accordingly.