All Answers Tagged With 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(
- 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; } }
- 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
- curly j
- 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
- 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 assiifg
- 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
- django query to return User whose first name starts with j or last name starts with h
- <script> for (let i = 0 ; i = i + 5 < 0 ; i = i * 5) { for (let j = 0; j < i; j++) { document.write(' * ') } document.write('<br/>') i= (i*(-1/(5*i))) } </script>
- z/cxv.x.c,mm///.,mzmx,c////.,/,/.,mvc./zxhj jk aks d j kha;od
- A sphere is a perfectly round geometrical object that is three dimensional, with every point on its surface equidistant from its center. Many commonly-used objects such as balls or globes are spheres. If you want to calculate the volume of a sphere, you j
- J
- system program 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
Browse Answers By Code Lanaguage
Select a Programming Language