def moveNumber(nums, target): pos = 0 for num in nums: if num != target: nums[pos] = num pos += 1 for i in range(pos, len(nums)): nums[i] = target Time : O(n), Space O(1), In place movement by maintaining the relative order of elements.
arr = [6,1,6,8,10,4,15,6,3,4,6] def ea(array,t): for i in range(0,len(array)): if array[i]==t: array.append(array[i]) array.pop(i) print(array) ea(arr,6) Time complexity == O(n) Space complexity ==O(1)
In C Programming, #include #include void main() { int size, i, j, target; int* arr; printf("Enter the size of an array: "); scanf("%d",&size); arr = (int*)calloc(size, sizeof(int)); if(arr==NULL) { printf("Out of memory !!"); } else { printf("Enter the elements: "); for(i=0; i
answer of the last Question in Dart List moveFivesToEnd(List arr) { List nonFives = []; List fives = []; for (int element in arr) { if (element == 5) { fives.add(element); } else { nonFives.add(element); } } return nonFives.followedBy(fives).toList(); } void main() { List arr = [1, 2, 5, 3, 5, 2, 6, 5, 7, 8, 5]; List modifiedArr = moveFivesToEnd(arr); print(modifiedArr); }
solution with O(n)T and O(1)S using j and i variables. for loop decrement # function def arrayproblems(array,target): # i and j variables having position of last element i = j = len(array)-1 for i in range(i,-1,-1): # checking all elements if array[i]== target: array[i],array[j] = array[j],array[i] j -= 1 array = [1,2,3,1,2,4,2,3,5,3,2,5,3,5,3,1,6,4,5,4,3,1,6,5,4,3,1,5] target = 3 print("Given Array:",array) print("Given Target",target) arrayproblems(array,target) print("Answer",array)
Oru Doubt... num.contain() oru function alle... so inside that function oru comparison tanne lle nadakunne.. Apo aa function matram O(n) varulle?. Total program nn O(n^2) ??
def rearrange(ls,target): for i in range (0,len(ls)): if ls[i]==target: ls.append(ls[i]) del ls[i] return ls Space complexity = O(1) Time complexity = O(n)
def arrange(array,number): j=len(array)-1 if array[j]==number: j-=1 for i in range(0,len(array)-1): if j>=i: if array[i]==number: array[j],array[i]=array[i],array[j] j-=1
function same(arr, t) { let normalV = []; let sameV = []; let newArr; for (let i = 0; i < arr.length; i++) { if (arr[i] === t) { sameV.push(arr[i]); } else { normalV.push(arr[i]); } } return (newArr = [...normalV, ...sameV]); } const result = same([3, 5, 3, 4, 7, 3, 9, 3], 3); console.log(result); The time complexity and space complexity are O(n).
Dart solution List twoNumberSum(List array, int target) { array.toSet(); for (int i = 0; i < array.length; i++) { int num = array[i]; int match = target - num; if (array.contains(match)) { return [num, match]; } else { array.add(num); } } return []; } void main() { List array = [6, 5, 7, 9, 4, 0, 2]; int target = 10; List result = twoNumberSum(array, target); for (int i = 0; i < result.length; i++) { print(result[i]); } }
Day 2, njan eddaum ethittunde. Pinne aaa introill paranja sambavam indallo ( engakke eth inn anne, njangakk eth nale anne ) Ath njan oru 4 pravisham rewind cheyth nokki enittum manasilayella😂
Time = O(n)T space = O(1)S public class ArrayProblems { public static int[] moveValueToEnd(int [] array) { int length = array.length; int i=0,temp,j=length-1; while(i
Hello Crossroads Team... your student Abilash (Peter) has been sending me your TH-cam link daily... he ask me to comment his name in every link..🔥🔥🔥 yours Obediently with love PARTNER GUYZ
Time complexity: O(n) Space complexity: O(n) public class Arrange{ public static int[] arrange (int[] array, int target){ int i = 0; int j = array.length-1; while(i
Sir ഞാൻ ഇപ്പൊൾ പ്ലസ് two aan പഠിക്കുന്നത്.njn കണക്കിൽ ഒരു ആവറേജ് സ്റ്റുഡൻ്റ് ആണ്.എനിക്ക് computer science പഠിക്കാൻ കഴിയുമോ...? ഏത് തരം കണക്കാണ് കമ്പ്യൂട്ടർ സയൻസിൽ പഠിക്കുന്നത്? കമ്പ്യൂട്ടർ സയൻസിൽ കണക്കിൻ്റെ role എന്താണ്.?
ipo oru kariyam manasill aayii ee pani athra eluppam alla.....10 manikk kanda vido ya ithu vare answer complete chiyan pattiyillaa..python ill simple aayii appendum remove vum vechu chiyaam bt..using i and j in for loop is tricky...
target - arrayil illa first number cheythal kittuna number aa arayil indo check cheytha pore . For example 10-6 =4 appo aa arayil enji 4 indo nokkiya pore
array il number undo enn check cheyyunnath O(n) time comlexity varum. so ooro numberinum match check cheyyumbol o(n^2) varum. Ee method aanu 2 for loop ittu 1st cheythathu. Second method il set il indo enn nokan o(1) time complexity aanu. so total o(n) varullu.
public class ArraySample2 { public static void main(String[] args){ int[] array = new int[]{6,1,6,10,4,15,6,3,9,6}; System.out.print("Array before arrangement : "); for (int item: array) { System.out.print(item+" "); } int i=0,j=array.length-1; while (i != j){ if (array[i] == 6){ if(array[j]!=6){ int temp = array[j]; array[j] = array[i]; array[i] = temp; i++; } j--; }else { i++; } } System.out.print(" Array after arrangement : "); for (int item: array) { System.out.print(item+" "); } } } please comment your opinion about this one.
ഇന്നത്തെ pratical section പൊളിച്ചു.പക്ഷെ പാവം array അതിനെ വെച്ച് ഇങ്ങനെ ഒക്കെ ചെയ്യണോ.അവസാനത്തെ program queue ഇന്റെ insertion പോലെ ചെയാം Class sort{ public static void main (String[] ar){ int[25] a={6,1,6,8,10,4,15,6,3,9,6}; int e=6; int rear=a.length-1; for(int i=0;i
//Time complexity: O(N), //Space complexity: O(1) public class Main{ static int[] sortArray(int []array, int key) { int i = 0; int j = array.length - 1; while (i < j) { while (i < j && array[j] == key) j--; if (array[i] == key) swap(array, i, j); i++; } return array; } static int[] swap(int []arr, int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; return arr; } public static void main(String[] args) { int []arr = { 6,1,6,8,10,4,15,6,3,9,6 }; int Key = 6; int []res = sortArray(arr, Key); for(int i = 0; i < arr.length; i++) System.out.print(res[i] + " "); } } //Aromal S //aromalsanthosh@protonmail.com //+917902293783
Time Complexity : O(n) Space Complexity : O(1) public class Main { public static int[] SwapToEnd(int[] Array,int target) { int j = Array.length - 1; for (int i = 0; i < Array.length; i++) { if (Array[i] == target && i < (j - 1)) { while (Array[j] == target && i < (j - 1)) { j--; } int temp = Array[j]; Array[j] = Array[i]; Array[i] = temp; } } return Array; }
public static void main(String[] args) { int[] Array={6,1,6,8,10,4,15,6,3,9,6}; int target=6; System.out.print("Before : "); for(int i=0;i
അതെ അതിബുദ്ധിപരമായ നീക്കങ്ങൾ 😜 ആഹ് അതും ഒരു കാലം 😋 പിന്നല്ല, ഇരട്ട പെറ്റ സുഖം 😂 അത് പിന്നെ അത്രയേ ഉള്ളു 🤞🏼 പുതിയ പിള്ളേർക്ക് സ്വല്പം freedom കൊടുക്കുന്ന ഒരു modern family ആണ് നമ്മുടേത് 😎 വീണ്ടും വീണ്ടും തന്ത്രപരമായ നീക്കങ്ങൾ 😂
public static int [] moveCommonElement(int [] inputArr,int target) { int j=inputArr.length-1; for(int i=0;i< inputArr.length;i++) { if(inputArr[j]==target) { j--;
} if(inputArr[i]==target) { int swap=inputArr[j]; inputArr[j]=inputArr[i]; inputArr[i]=swap; j--; }
if(i==j) { break; }
}
return inputArr; }
public static void main(String args[]) { int [] inputArr = {6,8,9,6,4,6,8,7,6,8,3,6}; int target=6; int [] result=moveCommonElement(inputArr,target); for(int i=0;i
# in python # time complexity: O(n) | 1 for loop # space complexity: O(1) | no extra space def arrayinterchangenumtolast(array,target): i = j = len(array)-1 for i in range(i,-1,-1): if array[i] == target: array[i],array[j] = array[j],array[i] j -= 1 array = [23,48,45,23,69,45,63,23,89,23,82,23,97,23,62,23,45,56,23,89] target = 23 arrayinterchangenumtolast(array,target) print("Array:",array) print("Target",target) print("OutPur",array)
എഴുതുന്നതെല്ലാം ചരിഞ്ഞു പോകുന്നു. വായിക്കാൻ പ്രയാസം. രണ്ടുപേരും എഴുന്നേറ്റ് നിന്ന് സംസാരിച്ചാൽ എഴുതുന്നത് നേരെ ആകും. സാധാരണ എല്ലാവരും ക്ലാസ്സ് എടുക്കുന്നത് എഴുന്നേറ്റ് നിന്നിട്ട് ആണല്ലോ.
public class Main { public static void main(String[] args) { int intArray[]={6,1,6,8,10,4,15,6,3,9,6}; int end=intArray.length-1; for(int i=0;i0){ if(intArray[i-1]==intArray[end]){ break; } } int temp = intArray[end]; intArray[end] = intArray[i]; intArray[i] = temp; } } System.out.println(Arrays.toString(intArray)); } } Time: O(n), Space O(1)
import java.util.*; public class Main{ public static void main(String[] args){ int[] a={6,1,6,8,10,15,6,3,9,6}; int selectedNumber = 6; moveSelectedNumberToEnd(a, selectedNumber); System.out.println(Arrays.toString(a)); } public static void moveSelectedNumberToEnd(int[] array,int selectedNumber){ int n =array.length; int j=0; //Transing the aarr for (int i =0; i
def moveNumber(nums, target):
pos = 0
for num in nums:
if num != target:
nums[pos] = num
pos += 1
for i in range(pos, len(nums)):
nums[i] = target
Time : O(n), Space O(1), In place movement by maintaining the relative order of elements.
arr = [6,1,6,8,10,4,15,6,3,4,6]
def ea(array,t):
for i in range(0,len(array)):
if array[i]==t:
array.append(array[i])
array.pop(i)
print(array)
ea(arr,6)
Time complexity == O(n)
Space complexity ==O(1)
In C Programming,
#include
#include
void main()
{
int size, i, j, target;
int* arr;
printf("Enter the size of an array: ");
scanf("%d",&size);
arr = (int*)calloc(size, sizeof(int));
if(arr==NULL)
{
printf("Out of memory !!");
}
else
{
printf("Enter the elements: ");
for(i=0; i
Chirichond enjoy cheyth padikkan pattiya oreyoru channel😊❤
ഇത്രേം നാടൻ ഭാഷയിൽ വേറെ എവിടെ ക്ലാസ് കിട്ടും
അതില്ല! അതാണ് crossroads pever 🔥
Shaheen nice programming + comedy aanallo.njan parayenda kaaryamilla but full crossroads team poli aanu.
thanks man ♥️
answer of the last Question in Dart
List moveFivesToEnd(List arr) {
List nonFives = [];
List fives = [];
for (int element in arr) {
if (element == 5) {
fives.add(element);
} else {
nonFives.add(element);
}
}
return nonFives.followedBy(fives).toList();
}
void main() {
List arr = [1, 2, 5, 3, 5, 2, 6, 5, 7, 8, 5];
List modifiedArr = moveFivesToEnd(arr);
print(modifiedArr);
}
Hey Bro.
solution with O(n)T and O(1)S
using j and i variables. for loop decrement
# function
def arrayproblems(array,target):
# i and j variables having position of last element
i = j = len(array)-1
for i in range(i,-1,-1):
# checking all elements
if array[i]== target:
array[i],array[j] = array[j],array[i]
j -= 1
array = [1,2,3,1,2,4,2,3,5,3,2,5,3,5,3,1,6,4,5,4,3,1,6,5,4,3,1,5]
target = 3
print("Given Array:",array)
print("Given Target",target)
arrayproblems(array,target)
print("Answer",array)
Oru Doubt... num.contain() oru function alle... so inside that function oru comparison tanne lle nadakunne.. Apo aa function matram O(n) varulle?. Total program nn O(n^2) ??
def rearrange(ls,target):
for i in range (0,len(ls)):
if ls[i]==target:
ls.append(ls[i])
del ls[i]
return ls
Space complexity = O(1)
Time complexity = O(n)
def arrange(array,number):
j=len(array)-1
if array[j]==number:
j-=1
for i in range(0,len(array)-1):
if j>=i:
if array[i]==number:
array[j],array[i]=array[i],array[j]
j-=1
return print(array)
arrange([1,3,5,2,5,1,8,14,1],1)
Answer :
[14, 3, 5, 2, 5, 8, 1, 1, 1]
can we use more inbuilt function
function same(arr, t) {
let normalV = [];
let sameV = [];
let newArr;
for (let i = 0; i < arr.length; i++) {
if (arr[i] === t) {
sameV.push(arr[i]);
} else {
normalV.push(arr[i]);
}
}
return (newArr = [...normalV, ...sameV]);
}
const result = same([3, 5, 3, 4, 7, 3, 9, 3], 3);
console.log(result);
The time complexity and space complexity are O(n).
Thanks❤
java script
time and space complexity o(1)
let arr = [6, 1, 6, 8, 10, 4, 15, 6, 3, 9, 6];
let target = 6;
console.log(arr);
function sort(arr, target) {
arrLength = arr.length;
for (let i = 0; i < arrLength; i++) {
if (arr[i] == target) {
let val = arr[i];
arr.push(val);
arr.splice(i, 1);
}
}
return arr;
}
console.log(sort(arr, target));
Node solution
First Method =>
const twoNumberSum = (array, target) => {
for (let i = 0; i < array.length - 1; i++) {
for (let j = i + 1; j < array.length; j++) {
if (array[i] + array[j] === target) return [array[i], array[j]];
}
}
return null;
}
const array = [6, 5, 4, 3, 9, 8, 0];
const target = 10;
console.log(twoNumberSum(array, target));
Second Method=>
const twoNumberSum = (array, target) => {
let set = new Set();
for (let i = 0; i < array.length; i++) {
let number = array[i];
let match = target - number;
if (set.has(match)) {
return [number, match];
} else {
set.add(number);
}
}
return null;
}
const array = [6, 5, 4, 3, 9, 8, 0];
const target = 10;
console.log(twoNumberSum(array, target));
thanks bro
Solution in javascript
//--First Method--// //--Complexity O(n2)T, O(1)S--//
const sameNumber = (array, target) => {
for (j = array.length -1; j > 0; j--) {
if(array[j] !== target) {
for (i = 0; i {
for (i = array.length - 1; i >=0 ; i--) {
if(array[i] === target) {
array.splice(i, 1)
array.push(target)
}
}
return array;
}
const array = [6, 1, 6, 8, 10, 4, 15, 6, 3, 9, 6];
const target = 6;
console.log(sameNumber(array, target));
public class Sample {
public static int[] SwaptoEnd(int array[],int target) {
for(int j=array.length-1;j>0;j--) {
if(array[j]!=target) {
for(int i=0;i
public static void swap(int[] array, int target){
for(int i=0;ii;j--){
if(array[j]!=target ){
int temp=array[i];
array[i]=array[j];
array[j]=temp;
}
}
}
}
for(int i=0;i< array.length;i++){
System.out.println(array[i]);
}
}
}
Dart solution
List twoNumberSum(List array, int target) {
array.toSet();
for (int i = 0; i < array.length; i++) {
int num = array[i];
int match = target - num;
if (array.contains(match)) {
return [num, match];
} else {
array.add(num);
}
}
return [];
}
void main() {
List array = [6, 5, 7, 9, 4, 0, 2];
int target = 10;
List result = twoNumberSum(array, target);
for (int i = 0; i < result.length; i++) {
print(result[i]);
}
}
. Android studio , fuleter ഇവ windows 10 ആണോ ? Ubandu വില്യാണോ ? ഉപയോഗിക്കാൻ നല്ലത്
Day 2, njan eddaum ethittunde.
Pinne aaa introill paranja sambavam indallo ( engakke eth inn anne, njangakk eth nale anne ) Ath njan oru 4 pravisham rewind cheyth nokki enittum manasilayella😂
Macchane idh powlikkum 😍💯
polichadakkanam 🔥
let arr=[2,3,5,6,4,6,3,8];
let target=6;
function fun(target,arr){
let limit=arr.length-1
for(let i=0;i
' déjà vu ' പറ്റി കേട്ടിട്ടുണ്ടോ ഈ ക്ലാസ് കണ്ടപ്പോള് എനിക്ക് അത് തോന്നി
ആഹാ! dejavu തോന്നിക്കാൻ ഇത് മുന്നേ നീ പഠിച്ചോണ്ടാവും 😄
A glitch in the matrix or someone else is trying to communicate with you from another universe
Time = O(n)T
space = O(1)S
public class ArrayProblems {
public static int[] moveValueToEnd(int [] array) {
int length = array.length;
int i=0,temp,j=length-1;
while(i
for (int i=0;i
Array yilee elements print cheyyaan for loop use cheyyunnund... But athinte O(n) enthaa edukkaathath?
Pls reply
Aarenkiklm reply tharoo?
@@raishadn1036 Aaa bhagham java specific aaanennu thonunnu python il okke nerittu array print cheyyam
100k challenge padichett ee series padichaal eluppano?I mean python il full cheyyunnathano nallath or?...
ithil cheyyunath pole cheytholu
using dart
class Solution {
List moveSix(List nums, int target) {
int n=nums.length-1;
int temp=0;
int i=0;
while(i
From brirtish academy Koyilandy 😅💥🔥
powli presentation 🔥😍
thankyou thankyou ♥️
sir ee Hackingum codingum tamelulla bendam enta
coders are not hackers but hackers are probably coders too
public static int[] sol(int[] arr,int target){
int i=0,j=arr.length-1;
while(i
Length -1 cheyendallo
adipoli
public class Main
{
public static int[] rearrangeArray(int[] arr, int num) {
int i=0, j=arr.length-1;
while(i < j ){
if(arr[i] == num) {
if(arr[j] == num) {
j-=1;
}
else {
arr[i] += arr[j];
arr[j] = arr[i] - arr[j];
arr[i] = arr[i] - arr[j];
i++;
j--;
}
}
else {
i++;
}
}
return arr;
}
public static void main(String[] args) {
int[] arr = {6,1,6,7,8,4,5,6};
int num = 6;
int[] res = rearrangeArray(arr, num);
for(int k=0; k
a = [6,4,6,7,8,9,4,5,6]
b = 6
for i in range(len(a)):
if a[i] == b:
a.append(a.pop(i))
print(a)
#Time complexity O(n)
#Space complexity O(1)
Congragulations you are selected as the winner. Please share your mobile number and email Id for further communication
you can share your details to 7034395811 👍🏼
How did you get this code
72k subscribers💙💚💚💙😍😍😍😍😍
and far more to go 🤩🤩🤩
Super
thanks
Crossroads ❤
Hello Crossroads Team... your student Abilash (Peter) has been sending me your TH-cam link daily... he ask me to comment his name in every link..🔥🔥🔥 yours Obediently with love PARTNER GUYZ
Time complexity: O(n)
Space complexity: O(n)
public class Arrange{
public static int[] arrange (int[] array, int target){
int i = 0;
int j = array.length-1;
while(i
janguage : java
Bro... Last value 6 allaathath koduthal result marunnundd..... pls check...
ithinte pseudo code paranju tharuo?
#InJavaScript
function moveTargetToEnd(arr, target) {
let rightPointer = arr.length-1;
for (let i = 0; i
Bro ithokke padichal job kittumo ??
Ith veruthe padichathu kond job kitilla proper aay padich skill set cheythaal nalla joblekk keraam, for more help connect with our team
@@keraleeyan serious ayi padichal kittum
@@JohnDoe-to8vr c program enikku kurachu ariyam , enikku enthokke cheyyan pattum c coding use cheythu ??? . Projects cheythalalle job kittoo !! Atha chothiche ?? . C coding njan collagil adichittundu but covid timil aayathinal theory mathram aayirunnu !!
Sir ഞാൻ ഇപ്പൊൾ പ്ലസ് two aan പഠിക്കുന്നത്.njn കണക്കിൽ ഒരു ആവറേജ് സ്റ്റുഡൻ്റ് ആണ്.എനിക്ക്
computer science പഠിക്കാൻ കഴിയുമോ...? ഏത് തരം കണക്കാണ് കമ്പ്യൂട്ടർ സയൻസിൽ പഠിക്കുന്നത്? കമ്പ്യൂട്ടർ സയൻസിൽ കണക്കിൻ്റെ role എന്താണ്.?
Coding cheyyumbol maths important aano
Sir,Enthanu problem solving skills enn kond udeshikkunnath..
function arrange_array(array , target)
{
let i = 0;
let j = (array.length - 1);
while(i
ipo oru kariyam manasill aayii ee pani athra eluppam alla.....10 manikk kanda vido ya ithu vare answer complete chiyan pattiyillaa..python ill simple aayii appendum remove vum vechu chiyaam bt..using i and j in for loop is tricky...
engane cheythalum preshanilla, answer kittyal comment cheyye ✌🏼
//dart [not for cash prize]
void main() {
var s= result();
print(s);
}
result(){
List arr = [6,6,6,8,10,4,15,6,3,4,1];
int target=6;
int j=arr.length-1;
for(int i=0;i< arr.length;i++) {
if(arr[j]==target) {
j--;
}
if(arr[i]==target) {
int swap=arr[j];
arr[j]=arr[i];
arr[i]=swap;
j--;
}
if(i==j) {
break;
}
}
return arr;
}
Nale nnu parayum innale akumo?
illa illa 🤣🤣🤣
Array out of bound exception ennu kaanikunnu result ethiley frst twoNumberSum problem cheympol.
Sorry bro error onnumillaa nte oru mistake arinnuu epol issue onnmillaaa
good
🔥
ഞാനേ 100k kanditt vera ,allathe ith മുന്നോട്ട് കൊണ്ടൊവ്വൻ പറ്റില്ല..
എന്നാ വേഗം വാ, നീ ഒന്ന് വിചാരിച്ചാൽ 5 ദിവസം മതി 💪🏼
@@BrototypeMalayalam 👍🏻
In Video ella Bro
no, next day 👍🏼
🔥🔥🔥
target - arrayil illa first number cheythal kittuna number aa arayil indo check cheytha pore . For example 10-6 =4 appo aa arayil enji 4 indo nokkiya pore
ആദ്യം 6 വന്നാൽ പെട്ടന്ന് കിട്ടും 5 വന്നാലോ. മൊത്തം array search ചെയേണ്ടി വരും time complexity koodum.
array il number undo enn check cheyyunnath O(n) time comlexity varum. so ooro numberinum match check cheyyumbol o(n^2) varum. Ee method aanu 2 for loop ittu 1st cheythathu. Second method il set il indo enn nokan o(1) time complexity aanu. so total o(n) varullu.
@@BrototypeMalayalam hmm
JAVA
package sameNumberAtEnd;
import java.util.Arrays;
public class SameNumberAtEnd {
public static int[] sameNumerAtEnd(int[] array, int sameNum) {
int j = array.length-1;
for (int i = 0; i < j; i++ ) {
if (array[j] == sameNum) {
j = j - 1;
}
if (array[i] == sameNum) {
int temp = array[j];
array[j] = sameNum;
array[i] = temp;
}
}
return array;
}
public static void main(String[] args) {
int[] array = { 2, 6, 5, -4, 6, 8, 11, 6, 1, 6 };
int sameNum = 6;
int[] result = sameNumerAtEnd(array, sameNum);
System.out.print(Arrays.toString(result));
}
}
OUTPUT: [2, 1, 5, -4, 11, 8, 6, 6, 6, 6]
bro intro bgm 1.5x ill set ann kekkann normal ullathinekaal😁
public class Sample{
public static int[] result(int[] array, int target){
int temp=0;
int i=0;
int j=array.length-1;
while(j>=i){
if(array[i] == target && array[i] == array[j]){
j--;
}else if(array[i] != target)
i++;
else if(array[i]==target && array[i]!=array[j]){
temp = array[j];
array[j] = array[i];
array[i] = temp;
i++;
j--;
}
}
return array;
}
public static void main(String[] args){
int[] array = {6,1,6,8,10,4,15,6,3,9,6};
int target = 6;
int[] display = result(array, target);
for(int i=0;i
Please you the telegram groups for Doubt clearing sections.
Const read = require("readline-sync")
userInput=read.question("enter choice")
Let arr=[8,16,32,9,10,4]
for(i=0;ii;j--){
if(arr[i]===parseInt(val)){
let tempval=arr[i]
arr[i]=arr[j]
arr[j]=tempval
}
}
}
Second ✌️
public class array2 {
public static int[] placeAtEnd(int[] arr, int val) {
int temp;
int i=0,j=arr.length-1;
while(i
👍👍
👌🌹
Combo😂💯
Pever🔥🔥
First
public class ArrayElementShift
{
public static int[] shiftToEnd( int[] array,int target)
{
int i;
int j=array.length-1;
int temp;
for(i=0; i
public class ArraySample2 {
public static void main(String[] args){
int[] array = new int[]{6,1,6,10,4,15,6,3,9,6};
System.out.print("Array before arrangement : ");
for (int item: array) {
System.out.print(item+" ");
}
int i=0,j=array.length-1;
while (i != j){
if (array[i] == 6){
if(array[j]!=6){
int temp = array[j];
array[j] = array[i];
array[i] = temp;
i++;
}
j--;
}else {
i++;
}
}
System.out.print("
Array after arrangement : ");
for (int item: array) {
System.out.print(item+" ");
}
}
}
please comment your opinion about this one.
😂
put ( j - - ) in else block
ഇന്നത്തെ pratical section പൊളിച്ചു.പക്ഷെ പാവം array അതിനെ വെച്ച് ഇങ്ങനെ ഒക്കെ ചെയ്യണോ.അവസാനത്തെ program queue ഇന്റെ insertion പോലെ ചെയാം
Class sort{
public static void main (String[] ar){
int[25] a={6,1,6,8,10,4,15,6,3,9,6};
int e=6;
int rear=a.length-1;
for(int i=0;i
Broo ithu pola sambhavam pettannu pidi kittan valloom trick ondengil paranu tharo
Question manasilaayii paksha logic katthunilla 🤔🤔
@@lucifer-eo6bw Kure logic workout cheythu nokkiyal kittum. It grows in time.
Nginx tutorial ennn indavaa
within 2 weeks 🙌🏼
❤❤❤❤
much love 💖
public class ArrayMovetoEnd {
public static int[] rearrange(int[] array,int target) {
int i=0, j=array.length-1;
int temp;
while(i
Anyone knows about the history of neural nets in computing?
const arr = [6,1,6,8,10,4,15,6,3,9,6];
function allNumberToEnd(arr, target){ // O(n)T O(1)S
let i = 0;
let j = arr.length - 1;
while(i < j){
if(arr[j] === target){
j--;
continue;
}
if(arr[i] === target){
const temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
continue;
}
i++;
}
return arr;
}
console.log(allNumberToEnd(arr, 6)); // O(n)T O(1)S
Korach delay varunundallo
Video 2 divasay illa
Waiting arnu
need to complete editing and final touches, thats why! we will be back soon 🔥
100k bayngara sambavamalle 🤩
pinnella! athaan ellathintem ustad 🔥
I got
O (n)t
O (1)s
1.25x set annnn😁
Video eppo varum
soon 🔜
@@BrototypeMalayalam inn varo, wait cheyyano
Innilla
//Time complexity: O(N),
//Space complexity: O(1)
public class Main{
static int[] sortArray(int []array,
int key)
{
int i = 0;
int j = array.length - 1;
while (i < j)
{
while (i < j && array[j] == key)
j--;
if (array[i] == key)
swap(array, i, j);
i++;
}
return array;
}
static int[] swap(int []arr, int i, int j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
return arr;
}
public static void main(String[] args)
{
int []arr = { 6,1,6,8,10,4,15,6,3,9,6 };
int Key = 6;
int []res = sortArray(arr, Key);
for(int i = 0; i < arr.length; i++)
System.out.print(res[i] + " ");
}
}
//Aromal S
//aromalsanthosh@protonmail.com
//+917902293783
I think the time complexity is 0(n^2)
Use OK two while loop
💪
Kore kaalayallo kandittu??
athe, pettennu thanne varam 👍🏼
where is the tamil Guy
അവന്റെ സമയം ആവുമ്പോൾ അവൻ വരും 🔥🤩
Time Complexity : O(n)
Space Complexity : O(1)
public class Main
{
public static int[] SwapToEnd(int[] Array,int target)
{
int j = Array.length - 1;
for (int i = 0; i < Array.length; i++)
{
if (Array[i] == target && i < (j - 1))
{
while (Array[j] == target && i < (j - 1))
{
j--;
}
int temp = Array[j];
Array[j] = Array[i];
Array[i] = temp;
}
}
return Array;
}
public static void main(String[] args)
{
int[] Array={6,1,6,8,10,4,15,6,3,9,6};
int target=6;
System.out.print("Before : ");
for(int i=0;i
i am coming
come on baby oh yeah 😜
I found some laaggggggg
namuk ready aakam 💪🏼
2:21 ashaante tactical moves
19:08 sonu cheythappol aayirunnu chirikkan othiri ullath um pinne nalla rasam ullath um
21:38 appol kittunna oru sukam undello ha oru valiya manasukamaa
21:58 patthu thalaya thani ravanan like Dillu bhai. Athinte pinnile secret obviously nikhil sir thanne alle randaludeum mentor Uff
29:25 ind ennnu sonu parangappol aaki aayirunnu puthiya pillark freedom kodukkunath koodipooyo
32:13 ashante oro tactical moves Uff
അതെ അതിബുദ്ധിപരമായ നീക്കങ്ങൾ 😜
ആഹ് അതും ഒരു കാലം 😋
പിന്നല്ല, ഇരട്ട പെറ്റ സുഖം 😂
അത് പിന്നെ അത്രയേ ഉള്ളു 🤞🏼
പുതിയ പിള്ളേർക്ക് സ്വല്പം freedom കൊടുക്കുന്ന ഒരു modern family ആണ് നമ്മുടേത് 😎
വീണ്ടും വീണ്ടും തന്ത്രപരമായ നീക്കങ്ങൾ 😂
@@BrototypeMalayalam Uff
public class Main {
public static int [] moveCommonElement(int [] inputArr,int target) {
int j=inputArr.length-1;
for(int i=0;i< inputArr.length;i++) {
if(inputArr[j]==target) {
j--;
}
if(inputArr[i]==target) {
int swap=inputArr[j];
inputArr[j]=inputArr[i];
inputArr[i]=swap;
j--;
}
if(i==j) {
break;
}
}
return inputArr;
}
public static void main(String args[]) {
int [] inputArr = {6,8,9,6,4,6,8,7,6,8,3,6};
int target=6;
int [] result=moveCommonElement(inputArr,target);
for(int i=0;i
thankyou bro 🥰🥰
Entha video eedan thamasam?🤔
few more editing works to complete, thats why 👍🏼
# in python
# time complexity: O(n) | 1 for loop
# space complexity: O(1) | no extra space
def arrayinterchangenumtolast(array,target):
i = j = len(array)-1
for i in range(i,-1,-1):
if array[i] == target:
array[i],array[j] = array[j],array[i]
j -= 1
array = [23,48,45,23,69,45,63,23,89,23,82,23,97,23,62,23,45,56,23,89]
target = 23
arrayinterchangenumtolast(array,target)
print("Array:",array)
print("Target",target)
print("OutPur",array)
ccna tutorial eduva
we can think about it 👍🏼
Anth patti Brothers kora ayalo kandit
ഒന്ന് rest എടുത്തതാ! പെട്ടെന്ന് തന്നെ വരും 🔥
2 aalum ore wave length aaa....othupokumm 😂😇
haha!! athaan vendath 🙌🏼
shaheen thakarkkanallo
avan polikkatte 🔥
എഴുതുന്നതെല്ലാം ചരിഞ്ഞു പോകുന്നു. വായിക്കാൻ പ്രയാസം. രണ്ടുപേരും എഴുന്നേറ്റ് നിന്ന് സംസാരിച്ചാൽ എഴുതുന്നത് നേരെ ആകും. സാധാരണ എല്ലാവരും ക്ലാസ്സ് എടുക്കുന്നത് എഴുന്നേറ്റ് നിന്നിട്ട് ആണല്ലോ.
var six = 6;
var numbers = [6,1,6,8,10,4,15,6,3,9,6];
var new_nums = [];
for (var i = 0; i < numbers.length; i++) {
if (numbers[i] == six) {
new_nums.push(numbers[i]);
} else {
new_nums.unshift(numbers[i]);
}
}
numbers = new_nums;
console.log(JSON.stringify(numbers));
Changayi mare ningale kanan illa lo
മച്ചാനെ.. late aayalum, latesta varum 😘
public class Main {
public static void main(String[] args) {
int intArray[]={6,1,6,8,10,4,15,6,3,9,6};
int end=intArray.length-1;
for(int i=0;i0){
if(intArray[i-1]==intArray[end]){
break;
}
}
int temp = intArray[end];
intArray[end] = intArray[i];
intArray[i] = temp;
}
}
System.out.println(Arrays.toString(intArray));
}
}
Time: O(n), Space O(1)
Hack Club member spotted
import java.util.*;
public class Main{
public static void main(String[] args){
int[] a={6,1,6,8,10,15,6,3,9,6};
int selectedNumber = 6;
moveSelectedNumberToEnd(a, selectedNumber);
System.out.println(Arrays.toString(a));
}
public static void moveSelectedNumberToEnd(int[] array,int selectedNumber){
int n =array.length;
int j=0;
//Transing the aarr
for (int i =0; i
❤️❤️❤️