CODE WITH VIRUS
Kanalga Telegram’da o‘tish
1 278
Obunachilar
Ma'lumot yo'q24 soatlar
Ma'lumot yo'q7 kun
Ma'lumot yo'q30 kun
Postlar arxiv
1 278
Repost from CODE WITH VIRUS
public int myFunction(int a,int b){
int c=0;
for(int i=a;i<=b;i++){
String d=String.valueOf(i);
int n=d.length();
int x=d.charAt(0)-'0';
int y=d.charAt(n-1)-'0';
if(x==y){
c+=1;
}
}
return c;
}
Baby Lions Integer
Java code
✅Share @coding_solution
1 278
Repost from CODE WITH VIRUS
int myFunction(int a){
int t,b,c,i,r=1;
t=0;
b=1;
for(i=2;i<=a;i++){
c=t+b;
if(c%2==1 && c<a){
r+=1;
}
t=b;
b=c;
}
return r;
}
C language
Fibonacci series code
✅Share @coding_solution
1 278
Repost from CODE WITH VIRUS
Largest sum cycle code
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class LargesSumCycle {
public static int solution(int arr[])
{
ArrayList<Integer> sum = new ArrayList<>();
for(int i = 0; i < arr.length; i ++)
{
ArrayList<Integer> path = new ArrayList<>();
int j = i;
int tempSum = 0;
while(arr[j]<arr.length && arr[j]!=i && arr[j]!=-1 && !path.contains(j))
{
path.add(j);
tempSum+=j;
j=arr[j];
if(arr[j]==i)
{
tempSum+=j;
break;
}
}
if(j<arr.length && i == arr[j])
sum.add(tempSum);
}
if(sum.isEmpty())
return -1;
return Collections.max(sum);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();;
for(int loop=0; loop<testCases; loop++){
int numofBlocks = scanner.nextInt();
int array[] = new int[numofBlocks];
int src, dest;
for(int i=0; i<numofBlocks; i++){
array[i]=scanner.nextInt();
}
System.out.println(solution(array));
}
scanner.close();
}
}
Juspay code
✅Share https://t.me/coding_solution 😎
1 278
Repost from CODE WITH VIRUS
import java.util.Arrays;
import java.util.Scanner;
public class MaximumWeightNode {
public static int solution(int [] arr){
int n = arr.length;
int count[] = new int[n];
Arrays.fill(count,0);
for(int i=0; i<n; i++){
if(arr[i]!=-1)
count[arr[i]]+=i;
}
int maxWeight=0;
int nodeNumber=0;
for(int i=0; i<n; i++){
if(count[i]>maxWeight){
maxWeight=count[i];
nodeNumber=i;
}
}
if(nodeNumber==0){
nodeNumber=-1;
}
return nodeNumber;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();;
for(int loop=0; loop<testCases; loop++){
int numofBlocks = scanner.nextInt();
int array[] = new int[numofBlocks];
int src, dest;
for(int i=0; i<numofBlocks; i++){
array[i]=scanner.nextInt();
}
System.out.println(solution(array));
}
scanner.close();
}
}
JUSPAY CODE
Maximum weight code
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
class UserMainCode
{
public int[] arrRotate(int input1, int[] input2, int input3){
for(int i=0;i<input3;i++)
{
leftrotate(input2,input1);
}
return input2;
}
void leftrotate(int[] input2, int input1)
{
int i, temp;
temp=input2[0];
for(i=0;i<input1-1;i++)
{
input2[i]=-input2[i+1];
}
input2[input1-1]=temp;
}
}
Java
Playing with numbers Code
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
Lcs with vowels code in python
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
Apparel house is an apparel in python
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
Reverse string word wise code in java
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
String permutations code in java
Share ✅ https://t.me/coding_solution
1 278
Repost from CODE WITH VIRUS
JUSPAY
Maximum weight node code
All test cases passed♥
Share https://t.me/coding_solution 😎
1 278
Repost from CODE WITH VIRUS
Largest sum cycle code
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class LargesSumCycle {
public static int solution(int arr[])
{
ArrayList<Integer> sum = new ArrayList<>();
for(int i = 0; i < arr.length; i ++)
{
ArrayList<Integer> path = new ArrayList<>();
int j = i;
int tempSum = 0;
while(arr[j]<arr.length && arr[j]!=i && arr[j]!=-1 && !path.contains(j))
{
path.add(j);
tempSum+=j;
j=arr[j];
if(arr[j]==i)
{
tempSum+=j;
break;
}
}
if(j<arr.length && i == arr[j])
sum.add(tempSum);
}
if(sum.isEmpty())
return -1;
return Collections.max(sum);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();;
for(int loop=0; loop<testCases; loop++){
int numofBlocks = scanner.nextInt();
int array[] = new int[numofBlocks];
int src, dest;
for(int i=0; i<numofBlocks; i++){
array[i]=scanner.nextInt();
}
System.out.println(solution(array));
}
scanner.close();
}
}
Juspay code
💽 Share https://t.me/coding_solution 😎
1 278
Analytical
10) Box Number 30
Ans: 35670
11) wife of A
Ans: Cannot determined
12)husband of Q
Ans: B
13)immediate left of s
Ans: R
14) S and Q interchange
Ans: B,C
15)BCE,EGL
ans: SQJ
16)if father is written as
Ans: RKUCPU
Telegram:- ✅Share @coding_solution
