Ungolfed:
Golfed (205 bytes):Code:/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { System.out.println(new String(new char[1000]).replace("\0", "A\n")); } }
Online:Code:import java.util.*;import java.lang.*;import java.io.*;class Ideone{public static void main (String[] args) throws java.lang.Exception{System.out.println(new String(new char[1000]).replace("\0", "A\n"));}}
http://ideone.com/fork/iRJhpL

Code:import java.util.Arrays; import java.util.Scanner; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int[] arr = new int[num]; for(int i =0;i<num;i++){ arr[i] = scan.nextInt(); } System.out.println(""); Arrays.sort(arr); for(int j:arr){ System.out.println(j); } }
![]()
PHP:import java.util.Arrays; class numbers{ private final static int lines = 8; private final static int numbers[] = new int[]{5,3,6,7,5,3,1,5}; public static void main(String[] args) { int[] arr = new int[lines]; for(int i =0;i<lines;i++){ arr[i] = numbers[i]; } Arrays.sort(arr); for(int number:arr){ System.out.println(number); } } }
![]()
pahala link ekata gihilla code eka dala ... thaman kemathi lenguage ekak select karagena ... inputs dala test karala balala ... eken thamange code ekata generate wena link eka share karanam hari
https://ideone.com/
weddo mekatath help ekak denna puluwanda balapalla
xml or html (help)
patta wadak![]()
Ai ban code challenges walata language ekak one na. Pseudo code hari kamak na concept Ekai enna one.
Anith eka language eke thiyena features use karana kisi athal ekak na ne.
Make a 1000 Line of 'A' without using for,while,do..while..goto..
or the new line character(\n) and with the least amount of codes.
USE ONLY JAVA
example out put..
A
A
A
A
A
A
.
.
.
I am little bit busy machan. What you're asking is bubble sort method. I don't have hands on experience with this so i don't like to be the wise guy by copy pasting a code from internet.
Great work by posting this thread machan. This will help lots of people to face better in their technical interviews. Specially Virtusa, WSO2.
Competitors, please try to avoid JDK or Language facilities to solve problems. Like arrays.sort(); Big companies expect you to learn those functions but they need to know that you know the theory behind it.
![]()
Ungolfed:
Golfed (205 bytes):Code:/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { System.out.println(new String(new char[1000]).replace("\0", "A\n")); } }
Online:Code:import java.util.*;import java.lang.*;import java.io.*;class Ideone{public static void main (String[] args) throws java.lang.Exception{System.out.println(new String(new char[1000]).replace("\0", "A\n"));}}
http://ideone.com/fork/iRJhpL
Code:public class Sort { public static void main(String[] args) { int[] arr = {5, 3, 6, 7, 5, 1, 3, 5 }; sortArray(arr); printArray(arr); } private static void sortArray(int[] arr) { for (int i = 0; i < arr.length; i++) { int low = i; for (int k = i + 1; k < arr.length; k++) { if (arr[k] < arr[low]) low = k; int temp = arr[i]; arr[i] = arr[low]; arr[low] = temp; } } } private static void printArray(int[] arr) { for (int i = 0; i < arr.length; i++) System.out.println(arr[i]); } }
![]()
here is my challenge.
(I work for a company as a security audit, and this is a cryptography 101 algorithm. There are no "perfect" algorithms and such algorithms are not practical for today. But if you can write a good one, you are many steps ahead in your programming career! At least give it a try.
You need to write an algorithm that accepts a 32 bit integer. Then, it has to provide two integers back, that when multiplied, produces the given number. Now the challenge is that BOTH of these returns values should be Prime numbers. If it can't find a prime number factorization, it should return 0.
Example: input = 35; output should be "7 * 35".
Input = 143; output should be 11*13 because 11*13 = 143.
You can find examples off the internet. But try to write one first.
Winner is chosen after a reasonable number of submissions. Fastest code wins.
At the time of evaluation, a sample input will be given, and the snippet that takes the smallest amount of time yet provides the correct answer wins.
patta thread ekak mchooo ela ela digatama yamu...![]()
Input දෙන්න ඕන තියෙන විදියට බං.. උඹ කෑල්ලක් අත ඇරලා කරලා තියෙන්නේ..
Input must be:
3
4
12
1
output :
1
4
12
එල PHP දාමු මචං ඊලග එකේ ඉදං.. මට නෙමේනේ Rep හම්බෙන්නේ උඹලටනේ![]()
here is my challenge.
(I work for a company as a security audit, and this is a cryptography 101 algorithm. There are no "perfect" algorithms and such algorithms are not practical for today. But if you can write a good one, you are many steps ahead in your programming career! At least give it a try.
You need to write an algorithm that accepts a 32 bit integer. Then, it has to provide two integers back, that when multiplied, produces the given number. Now the challenge is that BOTH of these returns values should be Prime numbers. If it can't find a prime number factorization, it should return 0.
Example: input = 35; output should be "7 * 35".
Input = 143; output should be 11*13 because 11*13 = 143.
You can find examples off the internet. But try to write one first.
Winner is chosen after a reasonable number of submissions. Fastest code wins.
At the time of evaluation, a sample input will be given, and the snippet that takes the smallest amount of time yet provides the correct answer wins.
## Code by owlX for Ek 3C
## Combatible with Python 3.x
import math
def prime_factorization(x):
if x == 0 | x == 1:
return None
result = []
for i in range(2,int(math.floor(math.sqrt(x)+1))):
while x % i == 0:
x /= i
result.append(i)
if x != 1:
result.append(x)
return result
while True:
n = int(input("Enter Value :"))
if n == -1: ##if you want to stop, enter -1
break
x = prime_factorization(n)
if len(x)==2:
print (x)
else:
print (0)



අන්න දැන් තේරුනා කොල්ලටInput eka ohoma new line eke denna oneda? uba kiyanne ethakota first input eka awilla number of integers in the list kiyala da? ethakota api output karanna one e gaanata wenakan?

Don't use google yako![]()

අන්න දැන් තේරුනා කොල්ලට
Don't use google yako![]()
![]()
![]()

උබට කවුද මචන් මේ කතාව කිව්වෙ.. අනේ මන්ද මම workshops ගොඩකට සහභාගි වෙලා තියෙනව. colombo uni එකෙන් කරන ඒව වගේම UK ඒවට පවා. question එකේ user input කියල තිබ්බට ඒක final variable එකකින් තමා represent කරන්නෙ..මචං User එයාලගේ values දෙන්න ඕන
උබට කවුද මචන් මේ කතාව කිව්වෙ.. අනේ මන්ද මම workshops ගොඩකට සහභාගි වෙලා තියෙනව. colombo uni එකෙන් කරන ඒව වගේම UK ඒවට පවා. question එකේ user input කියල තිබ්බට ඒක final variable එකකින් තමා represent කරන්නෙ..![]()
scanner class ලියන්න වෙලාව දෙන්නෙත් නෑ. වැඩකුත් නෑ. මාත් ඉස්සර scanner class දදා තමා කලේ. ඒත් colombo uni සර් කෙනෙක් තම එකක්දි කියල දුන්නෙ user inputs use කරන විදිය.

arrays.sort()..![]()

උබ මරුසිරා එකේ හිටපු වවුලා නේද..?![]()



කව්ද මචං සර් භාග්ය ද?උබට කවුද මචන් මේ කතාව කිව්වෙ.. අනේ මන්ද මම workshops ගොඩකට සහභාගි වෙලා තියෙනව. colombo uni එකෙන් කරන ඒව වගේම UK ඒවට පවා. question එකේ user input කියල තිබ්බට ඒක final variable එකකින් තමා represent කරන්නෙ..![]()
scanner class ලියන්න වෙලාව දෙන්නෙත් නෑ. වැඩකුත් නෑ. මාත් ඉස්සර scanner class දදා තමා කලේ. ඒත් colombo uni සර් කෙනෙක් තම එකක්දි කියල දුන්නෙ user inputs use කරන විදිය.
Meka attha..wadagath wenne user input eka ganna widihata wada code eke logic ekai..logic eka awul nam user input eken wadak na..![]()
ඒ වගේම උඹලා කියන එකටත් මං එකගයි. මං එහෙම කරන්න කිව්වේ ඉගෙන ගන්න ලේසියට අනිත් අයටත්අනිවා.Meka attha..wadagath wenne user input eka ganna widihata wada code eke logic ekai..logic eka awul nam user input eken wadak na..![]()
මට මතක විදියට 
එ්ක problem එකෙන් problem එකට වෙනස් වෙනවා මචං. උඹ හිතහන් මේක පටලවලා තියෙන්නේ problem is problem නේඅනිවා.මට මතක විදියට
එහෙම නැතුව user inputs අරන් මේ code එක ලියනව නම් හෙන කෙලියක් කරන්න ඕනෙ හරියටම ක්රෑශ් නොවී රන් වෙන්න නම්...
- Logic
- Efficiency
- Semantics
![]()
බලහන් මගේ problem එකේ විදියටමේ මොන පිස්සු කතාවක්ද? user inputs validate කරගෙන user friendly වෙන්න algorithm ලියන්නෙ මොන workshop එකේද බන්?කව්ද මචං සර් භාග්ය ද?
මේකයි මචං කේස් එක, අපි කොච්චර Logic එක දැනගෙන හිටියත් වෙලාවකට code කරගන්න බෑ. ඒක පැත්තකින් තියමුකෝ උඹලා කියන කතාව ඇත්ත. ඒත් හොද coder කෙනෙක් code කරන්නේ අපට ලේසි වෙන්න නෙමේ use කරන කෙනාට ලේසි වෙන්න. SMART CODING. Google I/O එකේ මේක ගැන කතා උනා මට මතක විදියට මේ සැරේ. ඒ වගේම UCSC මං join උන workshop එක්කනම් මං කියලා තියන විදියමයි කරේ. මගේ logic එක හරි උනත් අවසානෙට space එකක් ආපු හින්දා fail කරා. මේකමයි ගොඩක් වෙලාවට interview එක්කදි බලන්නෙත්.ඒ වගේම උඹලා කියන එකටත් මං එකගයි. මං එහෙම කරන්න කිව්වේ ඉගෙන ගන්න ලේසියට අනිත් අයටත්



අනේ මන්ද මචන් ඒක තමා මගේ කෝඩ් එකේ මම වෙනම lines කියල variable එකකට ඒක assign කරන් තියෙන්නෙ. රිවිව් කරන කෙනාට පැහැදිලිව පේනව කෝඩර් ඒක අදුන ගත්ත බව.එ්ක problem එකෙන් problem එකට වෙනස් වෙනවා මචං. උඹ හිතහන් මේක පටලවලා තියෙන්නේ problem is problem නේබලහන් මගේ problem එකේ විදියට
input :
5
5
45
1
4
5
output :
1
4
5
5
45
මේක දැකපු ගමන් සමහර උන්ට හිතෙන්නේ මං වැරදියට type කරලා කියලා. සමහර උන් confuse වෙනවා කෝ අනිත් 5 කියලා. ඒක තමා problem එකේ ස්භාවය ඕක කෙලින්ම දුන්නානම් sort කරන්න විතරනේ බං තියෙන්නේ.. ඒක තමා problem එක
think different


උබ පටන් ගත්ත වැඩේ නෙ.