## Forum Posts

- 0 Answers
**Get Total Canon Printer Service without the Hassle**Now you can be Printer to your experienced and expert engineer. He'll Supply You with accurate Are Responses to solve your problems. Your own Canon printer dealing with a few problems of late night? If so, then there's no requirement. There's full Canon printer service readily available to you through a toll-free service out of Assistance for All. It is one among the highest rated Canon printer support agency operating over the country.

- Apple iPhone support August 16, 2019

Printer support assistance lineup. Explain your problems regarding your Canon Postpone Can dial 1-877-916-7666 kind anyplace across the nation to find access to Canon You having a Canon printer to fulfil your printing demands from home or workplace? If yes, you then have to be described as a joyful customer, appreciating the excellent features with the device.| Flag | PURGE - 0 Answers
**How to fix Norton Antivirus not opening issue?**The best ways to deal with this snag is by updating Norton Antivirus software and ensuring that you never miss out on updates. Next method to avail is by installing the Norton Power Eraser tool and get rid of the error. Another widely used solution is by reinstalling Norton software in the operating system. And if none of them works, then the ideal way is to have a word with the technical experts at Norton phone number at any time feasible.

- emmawatson0705 August 16, 2019| Flag | PURGE - 0 Answers
**McAfee.com/activate + 1-888-722-1666 | Call Now**If your system clenched with the virus so now you have the best option. Call on +1-888-722-1666 and visit site Mcafee.com/Activate resolve immediate your issues at a very competitive rate. Our experienced team will help you with very politely. Get the most trusted antivirus security for your all types of device on Mcafee.com /myaccount .

- riponasimano August 13, 2019

For More Information Visit @ links: - Mcafee.com Activate| Flag | PURGE - 0 Answers
**Norton.com/setup +1-888-722-1666 | Call Now**Norton.com/setup - To Download, install and activate the Norton setup, go to norton.com/setup and get started with Norton product In the present time, an antivirus is expected to keep PC programming, PC applications, and information security; however a considerable lot of its antivirus should be utilized. Call now @ this number 1-888-722-1666 for more information visit @ links: - Norton install | Norton.com/setup

- riponasimano August 13, 2019| Flag | PURGE - 0 Answers
**HP Support Assistant +1-888-722-1666 | Call Now**HP Printer Assistant helps keep your computer, Laptop and other devices in working order by finding updates and providing troubleshooting tools like as HP Support Assistant hp printer support, hp customer service, hp support number, hp connected com, hp printer setup, hp connect. Most customer number +1-888-722-1666 for computers come with hp customer support.

- riponasimano August 13, 2019| Flag | PURGE - 0 Answers
**Interview Question**There is a street with n shops and each shop having k items. You need to start from the first and end at the last shop and find the minimum cost to pick items from each shop.

- sdutt.243 June 19, 2019

You can pick one item from each shop.

You cant pick same items from 2 adjacent shops.

Eg :

X 6 1 1

Y 50 50 50

Z 8 20 10

X, Y Z are items to be picked from each shop.

Minimum cost path -> 8,1,1| Flag | PURGE - 0 Answers
**hourglass**Given a 6*6 2D Array, :

- bhawana121998 October 24, 2018

1 1 1 0 0 0

0 1 0 0 0 0

1 1 1 0 0 0

0 0 0 0 0 0

0 0 0 0 0 0

0 0 0 0 0 0

We define an hourglass in A to be a subset of values with indices falling in this pattern in arr's graphical representation:

a b c

d

e f g

There are 16 hourglasses in arr, and an hourglass sum is the sum of an hourglass' values. Calculate the hourglass sum for every hourglass in arr, then print the maximum hourglass sum.

For example, given the 2D array:

-9 -9 -9 1 1 1

0 -9 0 4 3 2

-9 -9 -9 1 2 3

0 0 8 6 6 0

0 0 0 -2 0 0

0 0 1 2 4 0

We calculate the following hourglass values:

-63, -34, -9, 12,

-10, 0, 28, 23,

-27, -11, -2, 10,

9, 17, 25, 18

Our highest hourglass value is 28 from the hourglass:

0 4 3

1

8 6 6

Note: If you have already solved the Java domain's Java 2D Array challenge, you may wish to skip this challenge.

Function Description

Complete the function hourglassSum in the editor below. It should return an integer, the maximum hourglass sum in the array.

hourglassSum has the following parameter(s):

arr: an array of integers

Input Format

Each of the 6 lines of inputs arr[i] contains 6 space-separated integers arr[i][j].

Constraints

Output Format

Print the largest (maximum) hourglass sum found in .

Sample Input

1 1 1 0 0 0

0 1 0 0 0 0

1 1 1 0 0 0

0 0 2 4 4 0

0 0 0 2 0 0

0 0 1 2 4 0

Sample Output

19

Explanation

contains the following hourglasses:

The hourglass with the maximum sum () is:

2 4 4

2

1 2 4

int hourglassSum(vector<vector<int> > arr) {

int i,j,k,sum,max,count=0;

for(i=0;i<4;i++)

{

for(j=0;j<4;j++)

{

sum=0;

for(k=j;k<j+3;k++)

{

sum+=arr[i][k];

sum+=arr[i+2][k];

}

sum+=arr[i+1][j+1];

if(count==0)

{

max=sum;

count++;

}

else

{

if(max<sum)

max=sum;

}

}

}

return max;

}

please tell me what's wrong with my code?| Flag | PURGE - 0 Answers
**minimize digitsum**You are given positive integers N and D. You may perform operations of the following two types:

- ceaser October 19, 2018

add D to N, i.e. change N to N+D

change N to digitsum(N)

Here, digitsum(x) is the sum of decimal digits of x. For example, digitsum(123)=1+2+3=6, digitsum(100)=1+0+0=1, digitsum(365)=3+6+5=14.

You may perform any number of operations (including zero) in any order. Please find the minimum obtainable value of N and the minimum number of operations required to obtain this value.

this is my code I am getting the wrong answer in some test cases please let me know where I am wrong.

#include<iostream>

#include<queue>

using namespace std;

void check(long long int a, long long int &b, long long int &c, long long int d)

{

if(a<b)

{

b = a;

c = d;

}

}

int digitSum(long long int a)

{

int num = 0;

while(a>0)

{

num += a%10;

a = a/10;

}

return num;

}

void func(int N, int D, long long int &minElement, long long int &minTrial)

{

queue<long long int> q;

q.push(N);

if(N==1)

{

minElement = 1;

minTrial = 0;

}

long long int countNodes = q.size();

long long int level = 1;

int cnt = 1;

while(!q.empty())

{

countNodes = q.size();

while(countNodes>0)

{

long long int temp = q.front();

q.pop();

long long int first = temp+D;

check(first,minElement,minTrial,level);

if(minElement == 1)

{

return;

}

q.push(first);

long long second = digitSum(temp);

check(second,minElement,minTrial,level);

if(minElement == 1)

{

return;

}

q.push(second);

countNodes--;

cnt++;

if(cnt>1000000)

{

break;

}

}

if(cnt>1000000)

{

break;

}

level++;

}

}

int main()

{

long long int t = 1;

cin>>t;

while(t--)

{

long long int N, D;

cin>>N>>D;

long long int minElement = 1e18, minTrial = 1e18;

func(N,D,minElement, minTrial);

cout<<minElement<<" "<<minTrial<<endl;

}

return 0;

}| Flag | PURGE - 0 Answers
**globally unique identifier(GUID)**how to generate GUID in c/c++

- coder September 07, 2018| Flag | PURGE - 0 Answers
**Conversion of Java to C++**How can I convert Java source code into C/C++?

- suhara July 13, 2018| Flag | PURGE - 0 Answers
**Conversion of Java to C++**How can I convert Java source code into C/C++?

- suhara July 13, 2018| Flag | PURGE - 0 Answers
**Running time for a video question**Hi all,

- iosdevresume July 13, 2018

On one of the video Gayle presents the following problem -

"Given p number of people with their birth year and their death year, return the year with the maximum population".

At the same video she also states the best possible solution is O(P+Y) s.t. P is the number of peoples and Y is the length of the array of the years from the minimal birth year to the maximal death year, Can't the optimal solution be O(P)?

Here's how -

Generally she achieved a solution of O(P+Y) since she iterate through all the peoples in the input getting the minimal year and the maximal year that is O(P) which gives her Y the total number of years all the people was living in, then she instantiate an array on the size of Y that is O(Y), then she goes through every person in the input, add +1 for birth and -1 for deaths so that is O(P) and lastly she goes through all the array of years summing up the number of +1\-1 to that point which is giving her the number of people living in that year so again O(Y), all together it's O(P+Y+P+Y) => O(P+Y)

However - using a TreeMap (a hashmap that uses an inner tree to sort the dataset) we can achieve O(P), here's how -

traverse the people input and for every person p on the people list add +1 for the person birth year and -1 for the person death year that will end up with a tree with total (MAX) of 2*p nodes and traversing the tree to every year can yield that same result as traversing an array on the size of Y (however using a tree with 2p nodes is much memory efficient than using an array with potentially a-lot of unused 0's) while traversing the tree we can also keep int max which is the year with the max alive people in it.

Isn't that a better solution? or am I missing something?| Flag | PURGE - 0 Answers
**Implement a rate-limiter-like iterator and how to improve the space complexity**Given a <Word, TimeStamp> pair data type iterator as input. Implement an iterator based on it which can ignore the item if the same word has occurred in the past 10 seconds.

- sun2gz July 05, 2018

My implementation is to use a HashMap to memorize the word and its latest timestamp + 10s. For each new item, it will be checked against the HashMap to see if it has duplicated word occurred in the past 10s.

The interviewer asked me how to improve the space complexity if the string value varieties are infinite. He mentioned some boundary stuff.

Could anyone share some thoughts?| Flag | PURGE - 0 Answers
**Linked List addition with reversal, Google Interview**Given 2 Linked Lists containing single digit as data representing number with most significant digit at head and least significant at the tail return the addition of both.

- niklabh811 June 21, 2018

The solution must not reverse the given linked lists and do it in O(n) time complexity and constant space complexity(Recursive solution will take O(n) space because of stack).

For example:

9 -> 3 -> 2 -> 2 ->

+

3 -> 4 -> 8 -> 3 ->

=

1 -> 2 -> 8 -> 0 -> 5| Flag | PURGE - 0 Answers
**Question**Take as input N, a number. Take N more inputs and store that in an array.

- Sagarshvn June 16, 2018

a. Write a recursive function which counts the number of ways the array could be split in two groups, so that the sum of items in both groups is equal. Each number in the array must belong to one of the two groups. Print the value returned.

b. Write a recursive function which keeps track of ways an array could be split in two groups, so that the sum of items in both groups is equal. Each number in the array must belong to one of the two groups. Return type of function should be void. Print the two groups, each time you find a successful split.

Input Format:

Take as input N, a number. Take N more inputs and store that in an array.| Flag | PURGE

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window