java-cheatsheet / codechallenge

Code Challenge Solutions from different sources in Java by @anitsh

Home Page:https://anitshrestha.com.np

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Challenge

Code challenge solutions from different sources in Java programming language.

Objective

I want to improve my problem-solving and technical skills and keep my competitive edge by covering the core programming concepts and exploring further.

Listed below are few topics which helps improve capabilities.

  • Mathematics: Prime Number, Big Integer, Permutation, Number Theory, Factorial, Fibonacci, Sequences, Modulus

  • Sorting: Bubble Sort, Quick Sort, Merge Sort, Selection Sort, Radix Sort, Bucket Sort

  • Searching: Complete Search, Brute Force, Binary Search

  • String Processing: String Matching, Pattern Matching

  • Dynamic Programming: Longest Common Subsequence, Longest Increasing Subsequence, Edit Distance, 0/1 Knapsack, Coin Change, Matrix Chain Multiplication, Max Interval Sum

  • Graph Traversal: Flood Fill, Floyd Warshal, MST, Max Bipartite Matching, Network Flow, Articulation Point

“For me, great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense, and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing.” — Francis Sullivan

“An algorithm must be seen to be believed.” — Donald Knuth

“I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” — Linus Torvalds

“Algorithms + Data Structures = Programs.” — Niklaus Wirth`

How to become good at code challenges?

Observe, Introspect, Retrospect, Refactor, Repeat

Understand The Basics

Don't skip basics, mathematics, data structures and algorithms. Mathematics helps build a solution. The data structures are the tools and the algorithms are the techniques that are the arsenal that every good programmer must have, more the better. Else, you will only see a hammer and a nail.

Know The Process

To solve the challenge, start with trivial, slow ideas to form a heuristic technique, and then improve towards creative, fast algorithms which could be solved with specific techniques. So just solve as you can first even the exponential solution if it works it's fine, be grateful.

Start by solving easy problems, then medium, and finally the difficult ones. Try different types of problems from different sources.

Learn from other's solution and compare with your own. Try to understand what other did differently and analyse what can be improved, both in your solutions. This will help add more dimensions to problem analysis and solutions ideas.

Improve your understanding by trying to answer Why was it done this way?.

Estimate The Complexity

The time limit set for online tests is usually from 1 to 10 seconds. We can therefore estimate the expected complexity. During contests, we are often given a limit on the size of data, and therefore we can guess the time complexity within which the task should be solved. This is usually a great convenience because we can look for a solution that works in a specific complexity instead of worrying about a faster solution.

For example, if:

  • n <= 1 000 000, the expected time complexity is O(n) or O(nlogn)
  • n <= 10 000, the expected time complexity is O(n^2)
  • n <= 500, the expected time complexity is O(n^3)

Of course, these limits are not precise. They are just approximations, and will vary depending on the specific task.

Folders

resource folder contains learning materials.

About

Code Challenge Solutions from different sources in Java by @anitsh

https://anitshrestha.com.np


Languages

Language:Java 68.4%Language:HTML 19.4%Language:Python 7.7%Language:JavaScript 3.0%Language:CSS 1.5%