apex Category

Apex Coding Interview Challenge #8

Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix. For example, given the query string de and the set of strings [dog, deer, deal], return [deer, deal]. Hint: Try preprocessing the dictionary into […]

Rate this:

Read More

Apex Coding Interview Challenge #7

Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3. […]

Rate this:

Read More

Apex Coding Interview Challenge #6

Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input […]

Rate this:

Read More

Apex Coding Interview Challenge #2

Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one pass? Solution Test Complexity Analysis Time complexity: O(n) […]

Rate this:

Read More

Apex Coding Interview Challenge #1

This question was asked during an Amazon interview Following schema is provided: Account Total_Salary__c (Number) Max_Salary__c (Number) Account_Salary__c Account__c (lookup) Name (String) Salary__c (Number) An Account can have multiple Account_Salary__c records that lookup to an Account by the Account__c. Write a trigger that would update the Account Total_Salary__c, Max_Salary__c when a new Account salary record […]

Rate this:

Read More

Apex Pass by Reference Pass by Value Examples

Pass by value – all primitive data type arguments, such as Integer or String, are passed into methods by value. This means that any changes to the arguments exist only within the scope of the method. When the method returns, the changes to the arguments are lost. Non-primitive data type arguments, such as sObjects, are […]

Rate this:

Read More

Salesforce System Integration Interview Prep

Remote Process Invocation – Request and Reply Best solutions External Services – invokes a REST API call – allows to invoke externally hosted service in declarative manner. External REST service are available in a an OpenAPI or Integrant schema definition. Contains primitive data types, nested objects not supported. Transaction invoked from Lightning Flow. Integration transaction […]

Rate this:

Read More

Salesforce Platform Events, Change Data Capture, Real-Time Event Monitoring explained

Below details the different Salesforce events types for different use cases 1. Change Data Capture Select the entities that generate change event notifications. Change Data Capture sends notifications for created, updated, deleted, and undeleted records. All custom objects and a subset of standard objects are supported. /data/AccountChangeEvent – any changes to accounts Create account Update […]

Rate this:

Read More

Apex Rest API Architecture – Best Practices

What’s a Service/API A service/API is a function that is well-defined, self-contained, and does not depend on the context or state of other services. 1. Abstract vs Concrete When developing software we often use abstraction and polymorphism to get most of our applications. We want to reuse as much of the code as possible. Should […]

Rate this:

Read More

Apex Coding Interview Challenge #3

Coding question asked by Google Develop a Trigger on asset to count the amount of assets for a specific account. The value of the asset should increate on insert or undeleteand decrease on delete or reparent to a new account. Assumption: an asset cannot have a null AccountId, validation rule will fail and not save the record. […]

Rate this:

Read More