Ahmed Hamdy
BAN USERTeaching Assistant at Faculty of Engineering, Alexandria University, Egypt.
I am seeking Internships at the "big guys" companies :)
Yeah ... I am just thinking with you trying to figure it out, sorry...
Can we try the following: doing testing each factor?
24/2 = 12 >> m = 122
24/3 = 8 >> m = 38
and then choose the smallest one?
Just come to my mind, you can use GCD (time complexity O(logn)) to get factors of the n then using division get the other number.... and voila the m is here ...
24/2 = 12 >> m = 122
24/3 = 8 >> m = 38
and then choose the smallest one
I have edited the post with fixed solution...
For better experience, you should first make package and call it myExceptions.
Then create a new class which inherit from Exception
package myExceptions;
public class customException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public customException(String s)
{
super(s);
}
}
Then to use it
public class Test1
{
public static void main(String[] args) throws Exception
{
throw new customException("Mu new custom exception");
}
}
Isn't should be O(nlogn) for time complexity ??
- Ahmed Hamdy February 05, 2014polymorphism is a concept in programming which describe how to make many different forms. Of the code.
We can describe it like:
1. If I make a code generic to many types
2. Method overloading
3. In inheritance, we can find method overriding, and casting the parent class to one of its child classes (i.e. a good example of that the paint program, making array of shapes to hold the shapes, and shapes is a parent class that has a lot of children like rectangle, square, circle,...etc)
12/2 = 6 >> m = 62
- Ahmed Hamdy February 05, 201412/3 = 4 >> m = 43
Choose the smallest
BTW in your example you calculate 12 different than 24?