All Answers Tagged With j
- data = input()
data = data.split(" ")
n = len(data);
for i in range(n - 1):
min = i;
for j in range(i + 1, n):
if data[j] > data[min]:
min = j
if min != i:
temp = data[i]
data[i] = data[min]
data[min] = data[i]
print(da
- system program j
- why i could do this for (int i = 0 , j =0 ; i< 4 ; i++,j++)
- 0for i = 1, 100 do -- The range includes both ends. karlSum = karlSum + iend-- Use "100, 1, -1" as the range to count down:fredSum = 0for j = 100, 1, -1 do fredSum = fredSum + j end-- In general, the range is begin, end[, step].-- Another loop construct:r
- function removeDuplicates(arr) {
const result = [];
let found;
for (let i = 0; i < arr.length; i++) {
found = false;
for (let j = 0; j < result.length; j++) {
if (arr[i] === result[j]) {
found = true;
break;
}
- 0for i = 1, 100 do -- The range includes both ends. karlSum = karlSum + iend-- Use "100, 1, -1" as the range to count down:fredSum = 0for j = 100, 1, -1 do fredSum = fredSum + j end-- In general, the range is begin, end[, step].-- Another loop construct:r
- import javax.swing.*;
class Registration extends JFrame{Registration() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JFrame f=new Jframe("Registration Form");
JLabel l1,l2,l3,l4;
JTextField t1,t2;
JPasswordField p1,p2;
l1=new J
- int ctr = 100; one: for (int i = 0; i < 10; i++) { two: for (int j = 0; j < 7; j++) { three: while (true) { ctr++; if (i > j) { break one; } else if (i == j) { break two; } else { break three; } } } } System.out.println(ctr);
- make this code simple and easily understandable for beginners:
# number of rows
rows = 5
k = 2 * rows - 2
for i in range(0, rows):
# process each column
for j in range(0, k):
# print space in pyramid
print(end=" ")
k = k - 2
- d = {'Mark': 100.0, 'Peter': 50.0, 'John': 25.0}for i, j in d.items(): print (i + ' pays ' + str(j))
- let b = "10000";
let a = "1";
let arr1 = a.split("");
let arr2 = b.split("");
console.log(arr1)
console.log(arr2);
let maxArr = arr1.length > arr2.length?arr1:arr2;
let k = maxArr.length-1;
let i = arr1.length-1;
let j = arr2.length-1;
let ans = [];
let
- j
- for (i = 0; i < N; i++) for (j = 0; j < N; j++) { .... some O(1) code ... }
- public class PascalTriangle {
public static void generate(int numRows) {
for (int i = 0; i < numRows; i++) {
for (int j = 0; j <= i; j++) {
System.out.print(binomialCoeff(i, j) + " ");
}
System.out.println();
}
}
}
public static int binomialCoeff(
- f and j keys
- what is the time complexity of fun()? int fun(int n) { int count = 0; for (int i = 0; i < n; i++) for (int j = i; j > 0; j--) count = count + 1; return count; }
- find error #include <iostream>
using namespace std;
int main()
{
int arr[] = {5, 1, 4, 2, 3};
int n = sizeof(arr) / sizeof(arr[0]);
for (int i = 1; i <= n - 1; i++)
{
for (int j = 0; j < n - 1; i++)
{
if (arr[j
- void InsertionSort(int * a, int n) { int i, j, x; for (i = 1; i < n; i++) { x = a[i]; j = i - 1; while (j >= 0 && a[j] > x) { a[j + 1] = a[j]; j = j - 1; } a[j + 1] = x; } }
- Robinhood coding question 1, Given an array of integers a, the task was to count the no of pairs i, j , such that a[i] and a[j] are digit anagrams. In the given time frame, this is what i wrote. Kindly excuse me for the brute force technique. Thank you.
- class Solution:
def reverseVowels(self, s: str) -> str:
res = ""
vowels = {"a","e","i","o","u","A","E","I","O","U"}
j = len(s)-1
for i in range(len(s)):
if i<j:
if((s[i] in vowels) and(s[j] i
- curly j
- j assiifg
- private static void calcola(int i , function<integer , integer>fn){ int r = 0 ; for (int j = i ; j>0 ; j--) r = fn.apply(r); System.out.println(r); } calcola (9 , (p) -> { return p + 1;});
- j hgkjghhuihh hjjkfvj hrthkgh kr thkltg]
- #include <iostream> using namespace std; struct link //one element of list { int data; //data item link* next; //pointer to next link }; class link list //a list of links { private:// w w w. j a v a2 s . co m link* next; //pointer to first link public: li
Browse Answers By Code Lanaguage
Select a Programming Language