annu025
BAN USER
- 7of 7 votes
AnswerEvaluate infix expression: 2 + 3 * 5
- annu025 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
AnswerWrite a word processor that can do left and right justification for a sample input of string type.
- annu025 in United States
Here is an example:
This is a sample.This is a sample.This is a sample.
This is a sample.This is a sample.This is a sample.This is a sample.
Additional details:
* The left margin is 5 units.
* The right margin is 75 units.
* The input string is a single-spaced collection of words and punctuation.
* If the length of the word exceeds the right margin, then we must not break the word. Instead, we must print it on the next line and justify the existing line by adding more spaces to the middle of the line.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer String Manipulation - 2of 2 votes
AnswersReverse this string 1+2*3-20. Note: 20 must be retained as is.
- annu025 in United States
Expected output: 20-3*2+1| Report Duplicate | Flag | PURGE
String Manipulation - 0of 0 votes
AnswersYou are tasked with defining and implementing a function. as input, you are given an n x m matrix. x may appear any number of times in a matrix. your function should modify thebmatrix such that any row and column where x originally appears are completely over written with x
- annu025 in United States
For example:
- - - - -
- - - - -
- - - x -
x - - - -
- - - - -
Expected output:
x - - x -
x - - x -
x x x x x
x x x x x
x - - x -| Report Duplicate | Flag | PURGE
Software Engineer / Developer Matrix
Solution in Java:
public class FindElementInSortedRotatedArray {
private static int findElement(int [] input, int target){
if(input == null || input.length == 0){
return -1;
}
int start = 0;
int end = input.length - 1;
int mid = (start + end)/2;
for(int i = 0; i < input.length; i++){
// check if start to mid of input array is sorted
if(input[start] <= input[mid]){
// check if target element lies between start and mid
if(input[start] <= target && target <= input[mid]){
// if target lies with start and mid, set end pointer to mid-1
end = mid - 1;
}
else{
start = mid + 1;
}
}
// then check if mid to end of input array is sorted
else {
if(input[mid] <= target && target <= input[end]){
// set start pointer to mid + 1
start = mid + 1;
}
else {
end = mid - 1;
}
}
}
return -1;
}
public static void main(String[] args) {
{
int array[] = { 56, 58, 67, 76, 21, 32, 37, 40, 45, 49 };
findElementUsingBinarySearchTest(array, 45);
}
}
private static void findElementUsingBinarySearchTest(int[] array, int num) {
System.out.println("Element " + num + " found at = " + findElement(array, num));
}
}
My solution in Java:
import java.util.Random;
public class ShuffleDeckOfCards {
private static void shuffle(int[] input) {
int inputLength = input.length;
// class to generate random numbers
Random r = new Random();
for (int i = inputLength - 1; i > 0; i--) {
// Generate random index
int index = r.nextInt(i);
// swap i with randomly generated index
int temp = input[index];
input[index] = input[i];
input[i] = temp;
}
}
public static void main(String[] args) {
int[] cards = new int[52];
for (int i = 0; i < 52; i++) {
cards[i] = i + 1;
}
shuffle(cards);
}
}
// Time complexity: O(N)
public class Attempt1{
boolean[] row = new boolean[n];
boolean[] column = new boolean[n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (matrix[i][j] == "x") {
row[i] = true;
column[j] = true;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (row[i] || column[j]) {
matrix[i][j] = "x";
}
}
}
System.out.println("Resultant matrix: ");
printMatrix(matrix, n);
return matrix;
}
Here are my questions: 1. Is there a better way to solve this? 2. Should I consider a better data structure?
Thank you.
Repaaronfreunda, Human resources coordinator at Prestiga-Biz
Aaron , My work is to facilitate daily HR functions like track of employees records and supporting the interview process. I ...
Repfrancesdpayne, AT&T Customer service email at Cavium Networks
I am Frances Payne from Jacksonville, United States. I am working as a Rental manager in Magna Gases company. I ...
Repnoradweisser, Backend Developer at ASU
I am Nora, I am a writer, I write many types blogs and articles. I collected many types and astrology ...
Repirmajrichh, Junior programmer at AppNexus
I am Irma, seeking the position of a Historical Researcher at Littler’s where my expertise can be utilized to ...
Repgeraldgloria02, Android test engineer at Achieve Internet
I am a personal trainer. I design programs and provide nutritional advice and coaching. I wanted to share my knowledge ...
RepEllaFlores, Associate at Alcatel Lucent
Ella , a Tour bus driver in Sounds Great company Inc. A charter bus driver is responsible for providing comfortable and ...
Repanitajmiller3, Android test engineer at ADP
Je suis passionnée par le monde du marketing de marque. Je souhaite explorer Comment faire revenir l etre aimé avec ...
Repvickiwgerber, Member Technical Staff at Boomerang Commerce
I am Vicki From San Antonio USA, I am working as an Interior decorator in Golden Joy company. I have ...
Repneshujaha, Member Technical Staff at BMO Harris Bank
I am Neshu, a Camera Operator with a creative eye for detail and dedication to quality work. I am always ...
RepJe suis Hudson Will des États-Unis. Je travaille comme technicien dans une entreprise Éco Vannes. J'analyse et vérifie tous ...
Repchingdelisa, Accountant at ABC TECH SUPPORT
I'm a Creative director in San Diego, USA.I map out future plans and make sure the result and ...
Repjenniferdray9, Accountant at ABC TECH SUPPORT
Hi I am Jennifer D. Ray from san Diego.Currently i am working as a parts salesperson in Rite solution ...
Repkellydbrown23, Jr. Software Engineer at Auto NInja
I live in College Park USA with my family, and my current job is clerk in Luria’s company. I ...
Rephazelwlson80, abc at A9
I am a skilled civil engineer with many years of experience in a variety of engineering aspects. There are a ...
Repshirleyjbarker439, Animator at ASAPInfosystemsPvtLtd
Hello, I am Gladys. I am a Industrial Photographer. I started off my photographic career as a News photographer based ...
Repannaharricks, Computer Scientist at ABC TECH SUPPORT
Hi, I am a Social worker to help people handle everyday life problems. I also assist people who have issues ...
Repbrittneykestro, Personnel at Absolute Softech Ltd
I’m Brittney , an experienced professional working as a Recreation leader provides social services to disadvantaged Children, Families, Schools, and ...
Repshawt146, Applications Developer at ADP
I love Exploring and photography. I want to fill my life with happiness and beautiful mammaries. I also like to ...
Repdebbiewilsond, Software Trainee at Electronic Arts
I am Debbie from Nashua in Us.I Done my study from Us university .Now I am working in Science ...
Repjosephcday6, Android Engineer at Absolute Softech Ltd
I am SEO Executive in Elek-Tek company. I live in Morgantown USA. I won’t write any details about Best ...
Repsarciasonda, Associate at ABC TECH SUPPORT
Computer forensics investigators, also known as computer forensics specialists, computer forensics examiners, government , accounting firms, law firms, banks, and software ...
Repcarlaapepin, Area Sales Manager at Atmel
Hello, I am Carla and I live in San Bernardino, USA. I am working as a bookkeeper in a library ...
RepPriscillaRYoung, Aghori Mahakal Tantrik at Absolute Softech Ltd
Hi, I am Priscilla from California. I am working as a Business management consultant in Quality Merchant Services company. I ...
Repcherylbgrant, Python Experienced at Bankbazaar
Je suis Cheryl, une traductrice multilingue passionnée avec 3 ans d'expérience dans la traduction de différentes langues telles que ...
Reprachelwrosa1, Computer Scientist at ABC TECH SUPPORT
Hello, I am Rachel and I live in Charleston, USA. I am working as a data entry clerk who is ...
Repamayalopez800, Accountant at A9
I am Amaya ,working in the field of training and development coordinator for three years, focusing on teaching English as ...
RepRitterNicole, DIGITAL MARKETING at Arista Networks
I am Ritter, Experimental psychologist refers to work done who apply experimental methods to psychological study and the processes that ...
RepGrimesOtto, Java Developer at Coupondesh
I am Grimes Agriculture inspector. I examine agriculture commodities and related operations . I like listening to music, painting, and reading ...
Repmarywwaldrop7, Computer Scientist at Chelsio Communications
I am Mary ,working in the field of training and development coordinator for three years, focusing on teaching English as ...
Repvictorcraigw, Animator at Chicago Mercantile Exchange
Hi, I am Victor working as a Speech Writer in the USA. Spoke at an academic conference about mantra for ...
Sample input:
- annu025 March 07, 2018This is a sample.This is a sample.This is a sample.This is a sample.
This is a sample.This is a sample.This is a sample.This is a sample. This
is a sample.This is a sample.This is a sample.This is a sample.This is a
sample.