Skip to content
Advertisement

Tag: algorithm

Count the semiprime numbers in the given range [a..b]

I am solving Codility problem CountSemiprimes: Count the semiprime numbers in the given range [a..b]. Task description A prime is a positive integer X that has exactly two distinct divisors: 1 and X. The first few prime integers are 2, 3, 5, 7, 11 and 13. A semiprime is a natural number that is the product of two (not necessarily

How multiple recursion works? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. This post was edited and submitted for review 4 months ago and failed to reopen the post: Original close reason(s) were not resolved Improve this question I need

Java Staircase is printing in wrong direction (hackerrank)

This solution to the staircase prints the correct output, but in the opposite direction. Any idea how to alter this solution to get the desired result? Input: Expected output: Actual Output: It’s for a hackerrank easy challenge. I just want to be able to use my approach that I discovered instead of a solution I find online. Thanks! Answer You

Benders.Strategy using Java and opl

I’m solving a mathematical model using Java however when i tried to call the Benders Strategy i keep receiving this error: Exception in thread “main” java.lang.IllegalArgumentException: No enum class ilog.cplex.cppimpl.IloCplex$IntParam with value 1501 at ilog.cplex.cppimpl.IloCplex$IntParam.swigToEnum(IloCplex.java:1974) at ilog.opl.IloCplex.setParam(IloCplex.java:5640) Here’s a part of my code in Java (i’m using CPLEX 12.8 and the library oplall.jar) : Answer There’s a similar question here.

Need explanation for algorithm searching minimal large sum

I’m solving Codility questions as practice and couldn’t answer one of the questions. I found the answer on the Internet but I don’t get how this algorithm works. Could someone walk me through it step-by-step? Here is the question: And here is the solution I found with my comments about parts which I don’t understand: Answer So what the code

Advertisement