|
| 1 | +# Code Challenge |
| 2 | + |
| 3 | +Code challenge solutions from different sources |
| 4 | +in Java programming language. |
| 5 | + |
| 6 | +## Objective |
| 7 | + |
| 8 | +I want to improve my problem-solving |
| 9 | +and technical skills and keep my |
| 10 | +competitive edge by covering the core |
| 11 | +programming concepts and exploring |
| 12 | +further. |
| 13 | + |
| 14 | +Listed below are few topics which |
| 15 | +helps improve capabilities. |
| 16 | + |
| 17 | +- Mathematics: Prime Number, Big Integer, |
| 18 | +Permutation, Number Theory, Factorial, |
| 19 | +Fibonacci, Sequences, Modulus |
| 20 | + |
| 21 | +- Sorting: Bubble Sort, Quick Sort, |
| 22 | +Merge Sort, Selection Sort, Radix Sort, |
| 23 | +Bucket Sort |
| 24 | + |
| 25 | +- Searching: Complete Search, Brute Force, |
| 26 | +Binary Search |
| 27 | + |
| 28 | +- String Processing: String Matching, |
| 29 | +Pattern Matching |
| 30 | + |
| 31 | +- Dynamic Programming: Longest Common |
| 32 | +Subsequence, Longest Increasing Subsequence, |
| 33 | +Edit Distance, 0/1 Knapsack, Coin Change, |
| 34 | +Matrix Chain Multiplication, Max Interval Sum |
| 35 | + |
| 36 | +- Graph Traversal: Flood Fill, Floyd Warshal, |
| 37 | +MST, Max Bipartite Matching, Network Flow, |
| 38 | +Articulation Point |
| 39 | + |
| 40 | +*“For me, great algorithms are the poetry of |
| 41 | +computation. Just like verse, they can be terse, |
| 42 | +allusive, dense, and even mysterious. |
| 43 | +But once unlocked, they cast a brilliant new |
| 44 | +light on some aspect of computing.” |
| 45 | +— Francis Sullivan* |
| 46 | + |
| 47 | +*“An algorithm must be seen to be believed.” |
| 48 | +— Donald Knuth* |
| 49 | + |
| 50 | +*“I will, in fact, claim that the difference |
| 51 | +between a bad programmer and a good one is |
| 52 | +whether he considers his code or his data |
| 53 | +structures more important. |
| 54 | +Bad programmers worry about the code. |
| 55 | +Good programmers worry about data structures and |
| 56 | +their relationships.” — Linus Torvalds* |
| 57 | + |
| 58 | +*“Algorithms + Data Structures = Programs.” |
| 59 | +— Niklaus Wirth`* |
| 60 | + |
| 61 | +## How to become good at code challenges? |
| 62 | + |
| 63 | +*Observe, Introspect, Retrospect, Refactor, Repeat* |
| 64 | + |
| 65 | +##### Understand The Basics |
| 66 | +Don't skip basics, mathematics, data structures |
| 67 | +and algorithms. Mathematics helps build a solution. |
| 68 | +The data structures are the tools and the algorithms |
| 69 | +are the techniques that are the arsenal that every |
| 70 | +good programmer must have, more the better. Else, |
| 71 | +you will only see `a hammer and a nail`. |
| 72 | + |
| 73 | +##### Know The Process |
| 74 | +To solve the challenge, start with trivial, slow |
| 75 | +ideas to form a heuristic technique, and then |
| 76 | +improve towards creative, fast algorithms which |
| 77 | +could be solved with specific techniques. So just |
| 78 | +solve as you can first even the exponential solution |
| 79 | +if it works it's fine, be grateful. |
| 80 | + |
| 81 | +Start by solving easy problems, then medium, and |
| 82 | +finally the difficult ones. Try different types |
| 83 | +of problems from different sources. |
| 84 | + |
| 85 | +Learn from other's solution and compare with your |
| 86 | +own. Try to understand what other did differently |
| 87 | +and analyse what can be improved, both in your |
| 88 | +solutions. This will help add more |
| 89 | +dimensions to problem analysis and solutions ideas. |
| 90 | + |
| 91 | +Improve your understanding by trying to answer |
| 92 | +Why was it done this way?. |
| 93 | + |
| 94 | +##### Estimate The Complexity |
| 95 | +The time limit set for online tests is usually |
| 96 | +from 1 to 10 seconds. We can therefore estimate |
| 97 | +the expected complexity. During contests, we are |
| 98 | +often given a limit on the size of data, and |
| 99 | +therefore we can guess the time complexity within |
| 100 | +which the task should be solved. This is usually |
| 101 | +a great convenience because we can look for a |
| 102 | +solution that works in a specific complexity instead |
| 103 | +of worrying about a faster solution. |
| 104 | + |
| 105 | +For example, if: |
| 106 | +- n <= 1 000 000, the expected time complexity is O(n) or O(nlogn) |
| 107 | +- n <= 10 000, the expected time complexity is O(n^2) |
| 108 | +- n <= 500, the expected time complexity is O(n^3) |
| 109 | + |
| 110 | +Of course, these limits are not precise. They are |
| 111 | +just approximations, and will vary depending on the |
| 112 | +specific task. |
| 113 | + |
| 114 | + |
| 115 | +# Folders |
| 116 | +`resource` folder contains learning materials. |
0 commit comments