Pega Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
1
of 1 vote

store the data from array to set

- Anonymous June 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1)
Sort the array nlogn
scan the sorted array using two indices and element duplicates between two indices
Runtime O(nlogn), space O(1)

2)
hash array elements as key to a hash-table, output the keys in the hashtable
Runtime O(n), space -- depends on hash-table, assuming typical, O(n)

- Anonymous May 22, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

set data "2 7 4 3 2 7 2 8 9 1 2"
set data [ lsort $data ]
puts $data
set i 0
for { set i 0 } { $i < [ llength $data ] } { incr i } {
set j $i
while { [ lindex $data $i ] == [ lindex $data $j ] } {
incr j
}
puts -nonewline "[ lindex $data $i ] "
set i [ expr { $j - 1 } ]
}

- durai December 15, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

You can use Set .. in which we have add() method which returns false if element is already present in the Set..

- devkashyap046 September 14, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function remove_duplicates(arr) {
	const store = {};
	let ptr = 0;

	for (let index=0; index<arr.length; index++) {
		if (!store[arr[index]]) {
			store[arr[index]] = true;
			if (index !== ptr)
				arr[ptr] = arr[index];
			ptr++;
		}
	}

	return arr.slice(0, ptr);
}

- sid July 07, 2018 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More