Vezita
BAN USER
- 1of 1 vote
AnswersWhat is the output of:
- Vezita in United Statesmain () { printf("%x", -1<<4); }
| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer - 0of 0 votes
AnswersWhat does the following program do ?
- Vezita in India
main ()
{
unsigned int num ;
int i ;
scanf("%u ", &num);
for(i=0;i<16;1++)
printf("%d",(num<<i & 1<<15) ? 1:0);
}
A. print all even bits from num
B. print all odd bits from num
C. prints binary equivalent of num| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer C
2 methods -
1st for replacing
2nd for counting the number of occurrence of substring
//to replace the string
//original = "Microsoft", substr = "ic" ,Replacement = "MSFT"
public static String StringReplace(String original, String substr, String Replacement)
{
String[] arr = original.split(substr);
StringBuilder output = new StringBuilder();
int i = 0;
for ( ; i < arr.length-1 ; i++)
output.append(arr[i]).append(Replacement);
output.append(arr[i]);
System.out.println(output);
if(original.substring(original.lastIndexOf(substr)).equalsIgnoreCase(substr))
output.append(Replacement);
System.out.println(""+output);
return output.toString();
}
//count the number of ocurrence of the replacement
public int NumOccurrence(String original, String substr)
{
int nOccurrence=0;
int n=0;
while(n <= original.length())
{
if ((original.indexOf(substr , n)) == -1)
break;
else
{
n= original.indexOf(substr,n);
nOccurrence++;
n++;
}
}
return nOccurrence;
}
}
IF EXTRA SPACE is ALLOWED
use hashSet in java .
1. create a new hashSet HS
2. for every element in the array, check if hashSet contains the element (using HS.contains(element)) .
if the method returns False , then add the element in the hashSet .
3. Traverse next element in arrray and repeat step 2.
Space Complexity: O(n)
Time Complexity: O(n)
Repinfo@strivashikaranupay.com, Associate at Adap.tv
Are you searching the strong and the most powerful Mantra for your husband? Consult our vashikaran specialist now. He provides ...
RepColaraJoshi, Floor manager at Thomes
By profession, I am Floor manager in the Thomes store. I am passionate about astrology and read tronto cards, horoscopes ...
Repmendezleah216, Analyst at Bosch
Hello,everybody,I'm Leah Mendez.I want to make some friends here.I’m a woman with ambition and ...
Repirenereed98, Discount Furniture Showcase at Physical therapist aid
I'm a Physical advisor helping working at Discount Furniture Showcase . I'm likewise a film buff who partakes in ...
RepLooking for the best day care center Charlotte? Pal-A-Roo’s Child Development Center is a family owned child care facility ...
Replonnacribbs, DIGITAL MARKETING at Athena Health
I am a Market Research Manager responsible for selecting the appropriate research methodology and supporting techniques to meet a defined ...
RepNirvedDavis, abc at 8x8
Professional lifeguard offering expertise in water safety. Worked for more than six years in guarding and controlling the safety of ...
RepMariaBJiles, Accountant at A9
I am working as a team leader in a development software company. I am creative in learning how to crochet ...
Repdevlinadevid, CAD Designer at FeatureCAM
Experienced CAD drafter seeking an advanced architectural position. Interested in culinary arts and currently in a course for making sushi ...
RepRocioNavarro189, None at Student
Hello Everyone,My name is Rocio Navarro Form Auckland,NZ,and 31 years old.I am searching for a servant ...
Repannehbell8, Quality Assurance Engineer at Globaltech Research
Build and maintain relationships with convention vendors. Resolve issues throughout meeting event timelines.Plan room layouts and event programs, schedule ...
RepAre you searching the strong and the most powerful Mantra for your husband? Consult our vashikaran specialist now. He provides ...
RepDasiySmith, abc at 247quickbookshelp
I am versati;e architect, accomplished at designing commercial and residential structures of varying styles and purpose.I was met ...
RepHandyman Homes is the one-stop destination for all your home improvement and handyman needs.We take care of residential & commercial ...
this solution does not consider the condition when color is unknown.
- Vezita June 29, 2014