Calculateur de complexité temporelle automatique
int i=1, s=1;
while(s<=n){
i++;
s+=i;
cout << "*"
}
Panicky Pelican
int i=1, s=1;
while(s<=n){
i++;
s+=i;
cout << "*"
}
s=0;
for (i = 0; i < n; i++)
for (j = 0; j < i; j++)
s++;
n= 100
k= 0
for i in range(0, n):
k= 12
for j in range(0, n, 2)
k += 1
print(k)
void function(int n){
int i=1, s=1;
while(s<=n){
i++;
s+=i;
cout << "*"
}
}
package NewPackage;
import java.util.HashMap;
public class AppleCodingQues {
public boolean isAnagram(String str1,String str2)
{
str1= toLowerCase(str1);
str2 = toLowerCase(str2);
return countCheck(str1).equals(countCheck(str2));
}
public HashMap<Character,Integer> countCheck(String str)
{
HashMap<Character,Integer> hs = new HashMap<>();
char[] arr = str.toCharArray();
for(int i=0;i<str.length();i++)
{
if(hs.containsKey(str.charAt(i))){
int a= hs.get(str.charAt(i));
hs.put(str.charAt(i),a+1);
}
else{
hs.put(str.charAt(i),1);
}
}
return hs;
}
public String toLowerCase(String str)
{
int len = str.length();
char[] arr = str.toCharArray();
for(int i=0;i<len;i++)
{
if((int)arr[i]<97)
{
arr[i]=(char)((int)arr[i]+26+6);
}
}
return String.valueOf(arr);
}
public static void main(String args[])
{
AppleCodingQues ap = new AppleCodingQues();
System.out.println(ap.isAnagram("trtt","trt"));
}
}
public static void sort012(int a[], int n)
{
// code here
int z=0,o=0,t=0;
if(a[i]==0) z++;
if(a[i]==1) o++;
if(a[i]==2) t++;
}
int k=z+o+t;
int i=0;
for(;i<z;i++){
a[i]=0;
}
for(int j=0;j<o;j++){
a[i++]=1;
}
for(int m=0;m<t;m++){
a[i++]=2;
}
#include<iostream>
}
int main()
{
vector<int> vect={2,4,9};
int target=10;
if(found(vect, target))
{
cout<<"true";
}
else
{
cout<<"false";
}
}