Dynamic Programming: Basics and a Practical Example

Introduction: Dynamic programming is a problem-solving technique that can seem quite intimidating at first glance. However, once you grasp its fundamentals and see it in action, you'll find it to be a powerful tool in your coding arsenal. In this blog post, we'll demystify the basics of dynamic programming and walk through a practical example. We'll provide you with clear explanations and a complete Python program, so you can understand and apply this essential concept with confidence. Understanding Dynamic Programming: At its core, dynamic programming is all about breaking down a complex problem into smaller, overlapping subproblems. It's a technique used to efficiently solve problems by storing and reusing solutions to these subproblems, rather than recomputing them. This leads to significant improvements in runtime complexity. Example: Fibonacci Sequence with Dynamic Programming Let's start by tackling a classic problem: calculating Fibonacci numbers. The Fibonac...

HourRank 24 - Hackerrank - 2-Nov-2017

Q-1 Strong Password


Louise joined a social networking site to stay in touch with her friends. The signup page required her to input a name and a password. However, the password must be strong. The website considers a password to be strong if it satisfies the following criteria:
- Its length is at least .
- It contains at least one digit.
- It contains at least one lowercase English character.
- It contains at least one uppercase English character.
- It contains at least one special character. The special characters are: !@#$%^&*()-+
She typed a random string of length  in the password field but wasn't sure if it was strong. Given the string she typed, can you find the minimum number of characters she must add to make her password strong?
Note: Here's the set of types of characters in a form you can paste in your solution:
numbers = 0 to 1
lower_case = a to z
upper_case = A to Z
special_characters = "!@#$%^&*()-+"
Input Format
The first line contains an integer  denoting the length of the string.
The second line contains a string consisting of  characters, the password typed by Louise. Each character is either a lowercase/uppercase English alphabet, a digit, or a special character.
Constraints
Output Format
Print a single line containing a single integer denoting the answer to the problem.
Sample Input 0
3
Ab1
Sample Output 0
3
Explanation 0
She can make the password strong by adding  characters, for example, $hk, turning the password into Ab1$hkwhich is strong.
 characters aren't enough since the length must be at least .

Solution : - 
Comming Soon


Comments

  1. if you stuck any where then comment and for other programming video solution visit and subscribe my you tube channel - https://www.youtube.com/channel/UC9XSeMvacrpXF3O1Y2hLeaw

    ReplyDelete

Post a Comment

Popular posts from this blog

Array Transformation | biweekly-contest-12 | leetcode | Java Solution

Dynamic Programming: Basics and a Practical Example

leetcode | Longest Substring Without Repeating Characters Solution