+ 3
Whats the first thing to consider before solving a code challenge
Problem solving
11 ответов
+ 14
Do I have a glass of water, a snack, paper and pencil on my dektop.
+ 8
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥
dehydration is not good for brain.
Also Sebastian Keßler never forgets sth. to drink if he codes.
🤫🤫🤫🤫 I take both:chocolate and red wine.
+ 6
Abraham Zimba
Although it looks funny, it is serious.
1. Did I understand the problem? Hopefully I have enough examples.
2. Regard a problem as a chain of other problems -> split problem until you can solve all sub problems
3. Describe subproblems on paper. Sketches might help
4. How far u split depends on your experience.
5. Transfer subproblems to methods or functions. But a method/function should not have too much lines(some say 5 lines not more)
@chillpill is master of sketches on papers.
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 posted a nice challenge: which word has the most anagrams in a given sentence?
Given: a sentence
Looking for: word with most anagrams
Sure what an anagram is?
Okay
Transform sentence to words
Do I know a given hack? If not... ask google
If I have a collection of words: which are pairwise anagrams?
I have an idea for a function that decides if two words are anagrams after 10 minutes or ask SL community...
+ 3
...now a function of(word, listofwords)--> number of anagrams in list of words
... for each word number of anagrams.
...finally word with max number of anagrams(hopefully part of your repertoire...else ask SL with link to own effort)
As you see - I advice google and post question.
I think, learning from other peoples snippets increases own knowledge more than hours of brain aching search for a not so good solution.
+ 2
Consider yourself first is can u able solve that problem
+ 2
Thanks pals. Though what I meant was 'is there a systematic way of solving challenges?'
+ 2
Thanks very much Oma Falk this really helpful
+ 2
Time complexity and what data structure you use in the problem