CodeKata | coding during the winter vacation
kandi X-RAY | CodeKata Summary
kandi X-RAY | CodeKata Summary
coding during the winter vacation
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Transverse trie .
- Checks if the value is anagram
- Add a word .
- Find the concatenated pair in the filter .
- Revers a string .
- Checks whether the set contains the given value .
- Returns a hash value for a String
- Gets list .
- Check if node contains a child .
- Adds a string value to the set .
CodeKata Key Features
CodeKata Examples and Code Snippets
Community Discussions
Trending Discussions on CodeKata
QUESTION
I'm trying to complete a Kata in Codewars, my first program in COBOL. The assignment is to inform BMI based on weight and height. But when I run my program it shows me the error of the title. I'm using COBOL 3.1 IBM, the compiler in CodeKata.
...ANSWER
Answered 2021-Dec-14 at 19:53The compiler gets confused because it only sees:
QUESTION
So i'm currently working on some pricing logic where the situations are:
- 1 glove costs $2.50, 2 gloves costs $4, therefore applying a 20% discount.
- If person buys 3 gloves then it should be the $4 + original price of $2.50 making total $6.50
- If person buys 4 gloves then it should be $8.
- 1 gum costs $0.65, you can buy 6 for the price of 5, so $3.25 for 6 instead of $3.90
- If person buys 7, then it should be 6 for $3.25 + original price of $0.65 totalling $3.90
- If person buys 8, then it should be 6 for $3.25 + (original price of $0.65 * 2) totalling $4.55
So it's very important at what index/stage that the discount needs to be applied by
I took my logic inspiration from this article: http://codekata.com/kata/kata01-supermarket-pricing/
I took my code inspiration from this article: https://github.com/raddanesh/Kata01
Specifically the VolumePricingStrategy as show in this diagram:
Here is my code attempt given the logic i want to achieve:
...ANSWER
Answered 2020-Nov-12 at 16:05Both situations require pretty much the same logic -- there's an individual price, and a group price, and any item that doesn't fit in a group gets the individual price.
So my approach would be to just use that as the basis for the logic. Write a function that takes as an input the qty, the group-qty, the individual price and the group price, like so:
QUESTION
I have problem with solution in this example Say Me Please Operations(codeKata):
You have a string with N numbers, every 2 numbers after an operation(?) return next number in this string. Write a function who return new string with respective operations :
1)addition,
2)subtraction,
3)multiplication,
4)division.
...ANSWER
Answered 2020-Jan-13 at 00:13Let's say v.length
is 5
.
You want to execute the following loops passes:
- i=0, j=1, k=2
- i=1, j=2, k=3
- i=2, j=3, k=4
But that's not what you're doing. You have j
and k
change semi-independently of i
.
- i=0, j=1, k=2
- i=0, j=1, k=3
- i=0, j=1, k=4
- i=0, j=2, k=3
- i=0, j=2, k=4
- i=0, j=3, k=4
- i=1, j=2, k=3
- i=1, j=2, k=4
- i=1, j=3, k=4
- i=2, j=3, k=4
To get the desired outcome, you should only have one loop. You can derive the other values from the loop variable.
You could derive j
and k
from i
as follows:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CodeKata
You can use CodeKata like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the CodeKata component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page