← SAP Interview Insights

SAP·Software Engineer·Online Assessment (OA)·Junior

Junior
Jun 2026

Summary

SAP software engineer interview, just one coding question about string concatenation. Pretty light, nothing that made me sweat.

Questions Asked (1)

Q1

Implement a strConcat(a, b) function that takes two strings and returns them joined together.

Algorithms & Data Structures
Author's notes

About as basic as it gets.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements, such as whether the function should handle null inputs, and then discuss the simplest implementation using string concatenation. Also, mention edge cases and potential optimizations, like using StringBuilder in Java for efficiency.

Pro tip: Demonstrate awareness of the underlying language specifics: in Java, string concatenation with '+' is optimized for simple cases, but in loops, StringBuilder is preferred. This shows you understand performance implications beyond the basic algorithm.

1. Clarify requirements

Ask about input constraints, such as whether nulls are allowed, and expected behavior for edge cases like empty strings.

2. Discuss basic implementation

Explain that the function can simply return a + b, and mention that this is O(n) time and space where n is the total length of the strings.

3. Address edge cases

Consider null inputs: decide whether to throw an exception, treat null as empty string, or return null. Also consider very large strings and memory implications.

4. Mention optimizations and alternatives

For languages like Java, note that using StringBuilder can be more efficient if concatenation is done repeatedly, but for a single concatenation, '+' is fine.

5. Provide code and test

Write clean code with proper naming and comments, and suggest test cases to verify correctness.

Key Points to Mention

  • Time and space complexity: O(n) where n is the combined length of the strings.
  • Handling of null inputs: clarify with interviewer or state assumptions.
  • Language-specific optimizations: e.g., StringBuilder in Java for multiple concatenations.
  • Immutability of strings in languages like Java and Python, and its performance implications.
  • Edge cases: empty strings, very large strings, and Unicode characters.
  • Testing: include unit tests for normal, edge, and error cases.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.